react router callback code example
Example 1: react callback set staet
setState( { name: "Michael" }, () => console.log(this.state));// => { name: "Michael" }
Example 2: callback in react
import React, { useCallback } from 'react';
function MyComponent() {
// handleClick is the same function object
const handleClick = useCallback(() => { console.log('Clicked!'); }, []);
// ...
}