A function for managing state within a class or function. The managed state is globally available.
the name of the state to be managed.
Optional
optional; the default value of the state.
A getter and setter function for the managed state.
function foo() { const [getMyState, setMyState] = useState("myState", false); setMyState(true); // This will set the state to true getMyState(); // This will return true} Copy
function foo() { const [getMyState, setMyState] = useState("myState", false); setMyState(true); // This will set the state to true getMyState(); // This will return true}
A function for managing state within a class or function. The managed state is globally available.