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

Function onClick

packages/react-dom/src/__tests__/ReactDOMNestedEvents-test.js:37–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 const [isClicked, setIsClicked] = useState(false);
36 const [isFocused, setIsFocused] = useState(false);
37 const onClick = () => {
38 setIsClicked(true);
39 const el = buttonRef.current;
40 el.focus();
41 // The update triggered by the focus event should not have flushed yet.
42 // Nor the click update. They would have if we had wrapped the focus
43 // call in `flushSync`, though.
44 Scheduler.log('Value right after focus call: ' + el.innerHTML);
45 };
46 const onFocus = () => {
47 setIsFocused(true);
48 };

Callers

nothing calls this directly

Calls 1

focusMethod · 0.65

Tested by

no test coverage detected