Zustand for context #271
Closed
Gustav-Eikaas
started this conversation in
Ideas
Replies: 1 comment
-
export const useZustandRoot = (
store: StoreApi<unknown>,
preventTeardown?: boolean
) => {
const initial = useRef(store.getState());
useEffect(() => {
return () => {
if (preventTeardown) return;
store.setState(initial.current, true);
};
}, [store]);
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I did some testing with Zustand and it seems like it might solve a lot of our problems and headaches.
It might be worth a try to migrate one of our components, powerbi, grid, garden or filter to test it out.
It does a lot of the heavy lifting that we manually handle in controllers for now
Beta Was this translation helpful? Give feedback.
All reactions