Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

usestate hook callback

const [counter, setCounter] = useState(0);

const doSomething = () => {
  setCounter(123);
}

useEffect(() => {
   console.log('Do something after counter has changed', counter);
}, [counter]);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #usestate #hook #callback
ADD COMMENT
Topic
Name
4+1 =