SolidJSS
SolidJSโ€ข4y agoโ€ข
1 reply
Mr Void

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
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);
}


I'm wondering if this is the right approach.
Was this page helpful?