4 ms·
Can someone explain why React can't have a more ergonomic syntax which compiles to useEffect()? Like svelte(reactivity) and vue(script setup and ref sugar) ca
by rk06 4y ago
Can someone explain why React can't have a more ergonomic syntax which compiles to useEffect()? Like svelte(reactivity) and vue(script setup and ref sugar) can compile their ergonomic syntax to actual apis
Given the dominance of react, "switching to vue" (let alone svelte/solid) is not a viable option for many. But surely someone can shamelessly steal from them?
- ht85 4y agoOne of the great qualities of react is to not be compiled, which removes an entire layer of confusion. It's a tradeoff but it is makes it a lot more predictable.
- satvikpendem 4y agoReact is actually getting a compiler in the future for memoization: https://www.youtube.com/watch?v=lGEMwh32soc https://www.youtube.com/watch?v=lGEMwh32soc
- ht85 4y agoI had not seen that, thank you. The compilation being optional, backwards compatible, and producing readable / step-debuggable JS seems like a really nice approach.
- rk06 4y agoWTF!!? "Not to be compiled" is not a feature. It is a lack of feature. Would you say it is better for everyone to ignore typescript and use js directly?
- ht85 4y agoTS is transpiled, not compiled (at least most of it, there are exceptions like enums and certain ES features depending on target).
- spion 4y agoIt was called MobX and it was getting more and more traction before the hooks hype.