-
Hi - I have a fairly complex implementation of zustand (I really like this library btw - it feels like a great balance of power and easy of use) for a game I'm building in react-three-fiber. I'd built out my state management using the slice selection syntax e.g. I'm trying to see what the fastest way is to create a minimal reproducible example is, but in the mean time, for a case where some store fetches use the transient update syntax and others do not, can you think of any reason why that could cause the problem I'm describing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I think I figured out the issue here. My Store looks generally like:
In a component I call In a component that's part of a react-three-fiber canvas I have:
This worked fine when I was using the state slice selector because it would re-render every time, but now that it's using the ref, the component doesn't re-render so the call to I am fine with forcing a re-render of the component when Is there any pattern here you would recommend? Or is the structure I have above not a good pattern? Sorry for what must seem a very basic question but having to think about the render loop this closely isn't something I have had to do before, so these are all new design patterns to consider. |
Beta Was this translation helpful? Give feedback.
I think I figured out the issue here. My Store looks generally like:
In a component I call
createFoos()
and I can verify they're created and now part of the state.In a component that's part of a react-three-fiber canvas I have: