React Internals (2017)
mattgreer.dev
mattgreer.dev
The APIs introduced after this are poorly designed in my opinion, the "function as children" context API (and TWO other ways to access context) and hooks
It's more likely that Facebook will start another framework (or compiler) in parallel. Or simply start using Svelte.
I'd love to be wrong about this. Especially since I'd rather not use tools from Facebook if possible.
Solidjs is also interesting IMO.
Svelte is not JavaScript. Svelte is a compiler that significantly changes the way code is executed, despite being superficially quite similar. Samples of code that look like they would be equivalent in JavaScript are not equivalent in Svelte.
This can be good for easily reaching a performant version, but it's also a major drawback.
Reconciling these approaches seems quite difficult--maybe the tsx compiler could begin to recognize some common patterns that can be compiled to simple in-place updates. But it would be brittle, since React is more expressive in that it allows lots of code that _can't_ be straightforwardly transformed into efficient in-place updates.
I would guess that 90%+ of all React written goes through a compile/transpile step in the development process which makes the difference between writing React apps and Svelte apps negligible.
I actually went back to React after using Svelte but I think the compile step makes more sense since you're not delivering the library to the end user.
Put simply, React calls your component, your component does not call React. Your UI code needs to work inside of React, not around it.
The relevant and most upvoted HN article on the difference between libraries and framework is:
The article you linked has the answer:
> has it established ways of doing things that are mutually-exclusive with other ways those things might be done?
The answer here is a solid No in the case of React. Nothing is mutually exclusive, because you choose to use Hooks in one component, a Class in another and you can still use React.createElement elsewhere and straight HTML with vanilla JS even somewhere else.
Svelte's model isn't strictly better; like almost everything in programming, it just has it's own set of tradeoffs.
Relevant tweet thread: https://mobile.twitter.com/dan_abramov/status/11354244236689...
This is ancient. Before the pandemic, even.