MCPcopy
hub / github.com/preactjs/preact / Comp

Function Comp

hooks/test/browser/useImperativeHandle.test.jsx:27–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 let ref;
26
27 function Comp() {
28 ref = useRef({});
29 useImperativeHandle(ref, () => ({ test: () => 'test' }), []);
30 return <p>Test</p>;
31 }
32
33 render(<Comp />, scratch);
34 expect(ref.current).to.have.property('test');

Callers

nothing calls this directly

Calls 3

useRefFunction · 0.90
useImperativeHandleFunction · 0.90
useStateFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…