You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove "Global" word in low level API because this is implied when you’re creating your state at the global scope. Also state-pool can be used to manage local state too, it’s just of the matter of where you’re declaring your state. So the new low level API will be as
For state creation
const user = createState();
Instead of
const user = createGlobalState();
For state consumption
[user, setUser] = user.useState();
Instead of
[user, setUser] = useGlobalState(user);
For state consumption with reducer
[user, setUser] = user.useReducer();
Instead of
[user, setUser] = useGlobalStateReducer(user);
What if I want to use the old API form
So if you want to use the old API form you could do it as
import{createState,useState}from"state-pool";constname=createState();functionComponent(){const[name,setName]=useState(name);// Or for useReducer asconst[name,setName]=useReducer(reducer,name);// other stuff…..}
The text was updated successfully, but these errors were encountered:
Remove "Global" word in low level API because this is implied when you’re creating your state at the global scope. Also state-pool can be used to manage local state too, it’s just of the matter of where you’re declaring your state. So the new low level API will be as
For state creation
const user = createState();
Instead of
const user = createGlobalState();
For state consumption
[user, setUser] = user.useState();
Instead of
[user, setUser] = useGlobalState(user);
For state consumption with reducer
[user, setUser] = user.useReducer();
Instead of
[user, setUser] = useGlobalStateReducer(user);
What if I want to use the old API form
So if you want to use the old API form you could do it as
The text was updated successfully, but these errors were encountered: