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

Function App

hooks/test/browser/useLayoutEffect.test.jsx:78–89  ·  view source on GitHub ↗
({ i })

Source from the content-addressed store, hash-verified

76 it('should execute multiple layout effects in same component in the right order', () => {
77 let executionOrder = [];
78 const App = ({ i }) => {
79 executionOrder = [];
80 useLayoutEffect(() => {
81 executionOrder.push('action1');
82 return () => executionOrder.push('cleanup1');
83 }, [i]);
84 useLayoutEffect(() => {
85 executionOrder.push('action2');
86 return () => executionOrder.push('cleanup2');
87 }, [i]);
88 return <p>Test</p>;
89 };
90 render(<App i={0} />, scratch);
91 render(<App i={2} />, scratch);
92 expect(executionOrder).to.deep.equal([

Callers

nothing calls this directly

Calls 4

useLayoutEffectFunction · 0.90
useStateFunction · 0.90
useRefFunction · 0.90
verifyRefFunction · 0.70

Tested by

no test coverage detected