const [check, setCheck] = useState(false); // ... setCheck(prevCheck => !prevCheck);
this.setState(prevState => ({ check: !prevState.check }));