Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to usestate in react

...
const [count, setCounter] = useState(0);
const [moreStuff, setMoreStuff] = useState(...);
...

const setCount = () => {
    setCounter(count + 1);
    setMoreStuff(...);
    ...
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #usestate #react
ADD COMMENT
Topic
Name
3+2 =