Hacker News new | ask | show | jobs
by rattray 2734 days ago
Exploring a bit, and sharing for those with similar curiosity...

This seems to have a React-ish architecture with familiar C# templating (Razor):

Razor syntax is the JSX-equivalent, which has been used for C# templating for years: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor...

Blazor Components: https://blazor.net/docs/components/index.html

Their docs are pretty scattered, especially for someone coming from React, but it seems to have similar features and lifecycle methods, albeit a bit more ersatz.

    onClick => onclick (etc)
    componentDidMount => OnInit / OnInitAsync
    componentWillReceiveProps => OnParametersSet[Async]
    componentDidUpdate => OnAfterRender[Async] 
    shouldComponentUpdate => ShouldRender
    componentWillUnmount => Dispose
There is also a convenient `bind` which is shorthand for `value="@Foo" onChange="@(e => Foo = e.target.value)"` and a magical `<FooComponent bind-Foo="@ParentFoo">` for passing state down...

You don't seem to be able to define multiple components in a single file (which in my experience leads to bloated components).

Routing seems to be defined within the .cshtml file rather than centrally, which can get messy in my experience.

I don't see anything to support state that is shared across far-flung leafs of a deep UI tree (eg; Redux, Context), but maybe there are standard .NET constructs for that which I'm not aware of.

I don't think this is going to win anyone from the React world – some design choices seem not to grok some key insights of React – but I can imagine it taking off amongst folks who were happy with server-side Razor templating and have been unhappy with Angular.