Creating a global store like redux
I'm attempting to create a store to keep track of user data across the application and so far this is what I have
I'm wondering if this is the right approach.
I'm wondering if this is the right approach.
const userStore = createStore({
username: null,
isLoading: true,
isLoggedIn: false
});
// similar to dispatch ( ? )
export const login = () => {
const [userState, setUserState] = userStore;
setUserState("isLoggedIn", true);
setUserState("isLoading", false);
}