React pass callback in props code example
Example: callback in react
import React, { useCallback } from 'react';
function MyComponent() {
// handleClick is the same function object
const handleClick = useCallback(() => { console.log('Clicked!'); }, []);
// ...
}