logoalt Hacker News

mg1clast Thursday at 2:24 AM1 replyview on HN

Not sure what this project is for... the only way to statically compile JSX into direct DOM mutations is to either castrate React's dynamic runtime flexibility and closure model, or break its semantics like SolidJS does (in this case worse because the lack of templating/syntax constraints just shifts the burden from the compiler to the developer).


Replies

rtpgtoday at 1:41 AM

Maybe a decade ago there was chatter in the Purescript land about FRP in an applicative context.

There's ways you can write your code such that you _know_ that certain blocks of code are going to be unaffected by input changes, and you can then use that information to reduce the scope of changes that need to be done, with only minimal costs to expressivity.

I think with a decently smart compiler (and of course the compiler simply treating a lot of stuff in a black box way) you can totally shrink down the amount of work a client needs to do to render React components, all without changing the semantics.

Of course any performance trick might change the actual sequence of events that happen, and in particular for libs doing fancy DOM manipulation, it's easy for those to rely on React's incidental behavior in a non-spec-confirming way.

But the main point her is that you can totally get to useful improvements on a subset of your React, while still leaving the rest of your components intact

show 1 reply