Files
react/compiler/crates/react_hermes_parser/tests/fixtures/useEffect-arg-memoized.js
2024-04-02 16:49:31 -07:00

17 lines
316 B
JavaScript

function Component(props) {
const dispatch = useDispatch();
useFreeze(dispatch);
// onUpdate should be memoized even though it doesn't
// flow into the return value
const onUpdate = () => {
dispatch({ kind: "update" });
};
useEffect(() => {
onUpdate();
}, [onUpdate]);
return <div />;
}