October 2019
Intermediate to advanced
426 pages
11h 49m
English
Repeating a similar process to the local Register Effect Hook, we are also going to extract the Effect Hook from our Login component to a separate useLoginEffect Hook function. This function will accept the following values from other Hooks as arguments: user, dispatch, and setLoginFailed.
Let's create a local Hook for the Login component now using the following steps:
function useLoginEffect (user, dispatch, setLoginFailed) {
useEffect(() => { if (user && user.data) { if (user.data.length ...Read now
Unlock full access