3 ms·
This approach is a classic footgun for beginners in the context of "hook rules". In general it's quite fragile.
by bvrmn 2y ago
This approach is a classic footgun for beginners in the context of "hook rules". In general it's quite fragile.
- seanwilson 2y agoCan you explain more? You're talking about React (hooks) here? Or this applies to Vue + JSX as well?
- bvrmn 2y agoIt's React thing. In maintenance context it's always better to not extract component instantiation. They could start to use hooks or they could be wrapped in conditions in a parent component and it would lead to severe quite hard to find issues.
- seanwilson 2y agoThis is a bonus of using Vue then if this kind of code doesn't pose a problem there? Makes me wonder why this is all so difficult. Vue has a lot less problems for me than previous iterations and frameworks, but it's still frustrating how many footguns still exist. Like gotchas where you lose reactivity where linters/compilers won't catch the problem for you, and you forget the gotchas if you're not immersed in that framework for a while. I'm not getting why we can't have robust static checking for this stuff vs trusting every developer to be careful.
- bvrmn 2y agoYep. I prefer Vue myself — no need to stay on toe tips full time. It's really a question of available ecosystem and quite phenomenal React's backward compatibility which ties very agile in other circumstances FE devs to the framework.