react_jwt_auth
react_jwt_auth copied to clipboard
Users.js: useEffect's dependency list should contain: axiosPrivate, location, navigate (or be removed)
The useEffect's dependency list in Users.js should contain: axiosPrivate, location, navigate (or be removed)
You must be reading that warning from the console. We only want the useEffect hook to run when the component loads, so we leave the dependency array empty. If the console warning bothers you, put this on the line above the useEffect dependency array: // eslint-disable-next-line
On Fri, Jun 24, 2022 at 4:25 AM Stefano Occhetti @.***> wrote:
The useEffect's dependency list in Users.js should contain: axiosPrivate, location, navigate (or be removed)
— Reply to this email directly, view it on GitHub https://github.com/gitdagray/react_jwt_auth/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHRWJN352ZX6YTD4JB4JCMDVQV5KBANCNFSM5ZXHPWYA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Drastically removing the dependency list fixes the warning. That is, at line 34: replace:
}, [])
with:
})
There is a difference in providing no dependency array and providing an empty one: https://stackoverflow.com/questions/58579426/in-useeffect-whats-the-difference-between-providing-no-dependency-array-and-an
On Mon, Jun 27, 2022 at 2:11 AM Stefano Occhetti @.***> wrote:
Drastically removing the dependency list fixes the warning. That is, at line 34: replace:
}, [])
with:
})
— Reply to this email directly, view it on GitHub https://github.com/gitdagray/react_jwt_auth/issues/2#issuecomment-1166967938, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHRWJN2VORVJGY6RD5ZFSCTVRFH2LANCNFSM5ZXHPWYA . You are receiving this because you commented.Message ID: @.***>