I have created two Zustand stores in a React application; one is called UserStore, and the other is called SettingsStore. How can I get the state from UserStore to SettingsStore?
import create from 'zustand';
const UserStore = (set, get) => ({
user: {},
});
I want to use this "user" variable to my other store called SettingsStore:
import create from 'zustand';
const SettingsStore = (set, get) => ({
});
You must import UserStore in the SettingStore file, and then use UserStore.getState().user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With