MCPcopy
hub / github.com/facebook/react / Example

Function Example

packages/react-reconciler/src/__tests__/useRef-test.internal.js:139–148  ·  view source on GitHub ↗
({phase})

Source from the content-addressed store, hash-verified

137 }
138
139 function Example({phase}) {
140 const hostRef = useRef();
141 const classRef = useRef();
142 return (
143 <>
144 <div key={`host-${phase}`} ref={hostRef} />
145 <Component key={`class-${phase}`} ref={classRef} />
146 </>
147 );
148 }
149
150 await act(() => {
151 ReactNoop.render(<Example phase="mount" />);

Callers

nothing calls this directly

Calls 5

toBeMethod · 0.65
useRefFunction · 0.50
useStateFunction · 0.50
useLayoutEffectFunction · 0.50
useEffectFunction · 0.50

Tested by

no test coverage detected