()
| 1 | import { useState, memo, useCallback } from 'react'; |
| 2 | |
| 3 | export default function App() { |
| 4 | const [num, update] = useState(0); |
| 5 | console.log('App render ', num); |
| 6 | |
| 7 | const addOne = useCallback(() => update((num) => num + 1), []); |
| 8 | |
| 9 | return ( |
| 10 | <div> |
| 11 | <Cpn onClick={addOne} /> |
| 12 | {num} |
| 13 | </div> |
| 14 | ); |
| 15 | } |
| 16 | |
| 17 | const Cpn = memo(function ({ onClick }) { |
| 18 | console.log('Cpn render'); |
nothing calls this directly
no test coverage detected