Answers for "How to do prevState with set hooks React.js"

2

prevstate in usestate

const [prevState, setState] = React.useState([]);

setState(prevState => [...prevState, 'somedata'] );
Posted by: Guest on June-09-2020

Code answers related to "How to do prevState with set hooks React.js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language