Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

update state in useState hook

// declare state using useState hook.
// someState is set to someInitialState
const [someState, setSomeState] = useState(someInitialState);

// setSomeState updates the current state 
setSomeState(someOtherState);
Source by reactjs.org #
 
PREVIOUS NEXT
Tagged: #update #state #useState #hook
ADD COMMENT
Topic
Name
1+8 =