diff --git a/src/final/02.extra-3.js b/src/final/02.extra-3.js index c95a57af..d017b94b 100644 --- a/src/final/02.extra-3.js +++ b/src/final/02.extra-3.js @@ -21,7 +21,9 @@ function useSafeDispatch(dispatch) { // interact with the dom may depend on the value being set React.useEffect(() => { mountedRef.current = true - return () => (mountedRef.current = false) + return () => { + mountedRef.current = false + } }, []) return React.useCallback( diff --git a/src/utils.js b/src/utils.js index 2ff73970..44d590a4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -5,7 +5,9 @@ function useSafeDispatch(dispatch) { React.useLayoutEffect(() => { mounted.current = true - return () => (mounted.current = false) + return () => { + mounted.current = false + } }, []) return React.useCallback(