Answers for "useSate object"

0

useSate object

[state, setState] = useState({})
const key = 'foo';
const value = 'bar';
setState(prevState => ({
  ...prevState,
  [key]: value
}));
Posted by: Guest on June-28-2021

Browse Popular Code Answers by Language