using this.setstate code example
Example 1: setstate in react
Functional Component
const [counter, setCounter] = useState(0);
setCouter(counter + 1);
Example 2: react setState
this.setState({
date: new Date()
});
Functional Component
const [counter, setCounter] = useState(0);
setCouter(counter + 1);
this.setState({
date: new Date()
});