4 ms·
I thought the issue with that is that it re-renders if any part of the context changes.
by symlinkk 4y ago
I thought the issue with that is that it re-renders if any part of the context changes.
- yawnr 4y agoYou’re correct and these people advocating for this are definitely re-rendering every component in their tree with every change
- dmak 4y agoIt just means you need more granular contexts right?
- symlinkk 4y agoRight, but then you have a ton of contexts littered everywhere. Seems like that would be a lot of clutter.
- gnomewrecker 4y agoIn my experience most of my state in contexts changes infrequently (auth information, or the “current client” for a dashboard, or whatever), and then local state is sufficient for the rest. The few times I have sufficiently complexity in the “middle” I indeed have been annoyed and had to be careful to avoid over-frequent rerenders. It’s just rare enough that “prefer contexts” is a good rule. Simpler, easier to understand code, with no Redux nonsense.
- yawnr 4y agoRedux isn’t nonsense you’re just being dismissive and not taking the time to learn to understand it properly.