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

Function App

packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js:1153–1191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1151 const targetRef = React.createRef(null);
1152
1153 function App() {
1154 const [count, setCount] = React.useState(0);
1155 const handleClick = () => {
1156 setCount(count + 1);
1157 };
1158 return <button ref={targetRef} onClick={handleClick} />;
1159 }
1160
1161 modernRender(<App />);
1162 await waitForAll([]);
1163
1164 eraseRegisteredMarks();
1165
1166 targetRef.current.click();
1167
1168 // Wait a frame, for React to process the "click" update.
1169 await Promise.resolve();
1170
1171 expect(registeredMarks).toMatchInlineSnapshot(`
1172 [
1173 "--schedule-state-update-2-App",
1174 "--render-start-2",
1175 "--component-render-start-App",
1176 "--component-render-stop",
1177 "--render-stop",
1178 "--commit-start-2",
1179 "--react-version-<filtered-version>",
1180 "--profiler-version-1",
1181 "--react-internal-module-start- at filtered (<anonymous>:0:0)",
1182 "--react-internal-module-stop- at filtered (<anonymous>:1:1)",
1183 "--react-internal-module-start- at filtered (<anonymous>:0:0)",
1184 "--react-internal-module-stop- at filtered (<anonymous>:1:1)",
1185 "--react-lane-labels-SyncHydrationLane,Sync,InputContinuousHydration,InputContinuous,DefaultHydration,Default,TransitionHydration,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Transition,Retry,Retry,Retry,Retry,SelectiveHydration,IdleHydration,Idle,Offscreen,Deferred",
1186 "--layout-effects-start-2",
1187 "--layout-effects-stop",
1188 "--commit-stop",
1189 ]
1190 `);
1191 });
1192
1193 it('regression test InputContinuousLane', async () => {
1194 const targetRef = React.createRef(null);

Callers

nothing calls this directly

Calls 4

waitForAllFunction · 0.85
toMatchInlineSnapshotMethod · 0.80
eraseRegisteredMarksFunction · 0.70

Tested by

no test coverage detected