-
I'm just digging into this now so I'll update with my findings either way. But just thought I'd ask in case someone with some more insight can help get me there quicker :) The sites I build all use the same design system and therefore the same breakpoints. Many components get altered based on these breakpoints. My starting point will be to create my own hook that then uses this hook (
If I am calling my hook all around a bunch of components, will each instance be creating its own subscriptions and listeners? If so, is the performance of this negligible enough that it wouldn't really matter? If the performance hit does grow with each component, I'm thinking I can do something like tie this into a global store (like redux), so that I'm only creating the subscriptions and listeners once, and then components just select the value from the global store. But that's a bit more complicated than I'm hoping for and might have some implications of its own. Anyways, any advice on what might be a good strategy here is much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Using the first method is performing well for me so far. I'll update if I run into anything as I add to more components. The component looks something like this:
|
Beta Was this translation helpful? Give feedback.
-
The hook is optimized to use large amount of subscribers. |
Beta Was this translation helpful? Give feedback.
Using the first method is performing well for me so far. I'll update if I run into anything as I add to more components. The component looks something like this: