MCPcopy
hub / github.com/BetaSu/big-react / App

Function App

demos/performance/Hook.tsx:3–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useState, memo, useCallback } from 'react';
2
3export 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
17const Cpn = memo(function ({ onClick }) {
18 console.log('Cpn render');

Callers

nothing calls this directly

Calls 2

useStateFunction · 0.90
useCallbackFunction · 0.90

Tested by

no test coverage detected