mirror of
https://github.com/facebook/react.git
synced 2026-02-26 04:24:58 +00:00
23 lines
459 B
JavaScript
23 lines
459 B
JavaScript
function Component(props) {
|
|
const item = useMutable(props.itemId);
|
|
const dispatch = useDispatch();
|
|
useFreeze(dispatch);
|
|
|
|
const exit = useCallback(() => {
|
|
dispatch(createExitAction());
|
|
}, [dispatch]);
|
|
|
|
useEffect(() => {
|
|
const cleanup = GlobalEventEmitter.addListener("onInput", () => {
|
|
if (item.value) {
|
|
exit();
|
|
}
|
|
});
|
|
return () => cleanup.remove();
|
|
}, [exit, item]);
|
|
|
|
maybeMutate(item);
|
|
|
|
return <div />;
|
|
}
|