3 ms·
> Like the author of this post, I appreciate Solid's API because component's only render (i.e. run) once by default and then you define which sections of the co
by aidenn0 5y ago
> Like the author of this post, I appreciate Solid's API because component's only render (i.e. run) once by default and then you define which sections of the component should re-render on changes by using "signals" provided by the library (e.g. `createSignal()` and `createEffect()`). In react, the entire component re-renders on every change and you need to specify which code should _not_ re-run. This was necessary because of the way react was created, but strikes me as fundamentally flawed.
I don't particularly like React, but this strikes me as the one thing it got right; the only "always correct" thing to do is to rebuild the VDOM on any change, so that's the default.
Then you can be more selective about which parts as performance dictates.
- jorroll 5y agoInteresting. I guess it just boils down to different preferences.
- matsemann 5y agoThat would be true if all a react component was dom output. But since it has side effects (rest calls, mutating state, effects), rerunning everything is the wrong thing to do in almost all instances.
- aidenn0 5y agoSure, if you put side effects in your react components, you're gonna have a bad time <insert South Park meme>.