3 ms·
In React you normally create local ephemeral state like this: const [myState, setMyState] = useState(null); I've created at least 3 libraries that follow
by franciscop 4y ago
In React you normally create local ephemeral state like this:
const [myState, setMyState] = useState(null);
I've created at least 3 libraries that follow that same pattern, but instead of ephemeral the state is saved somewhere:
// ?firstname=
const [firstName, setFirstName] = useQuery('firstname');
// localStorage
const [name, setName] = useStorage('name');
// global state (that can be connected to other places)
const [user, setUser] = useStore('user');