As we know,
In Login file, using React userState hook for controll and display UI in view
But in page, we using loginUser function, from UserContext
This function using 6 parameter userDispatch, loginValue, passwordValue, props.history, setIsLoading, setError
Some of this is arror function to change some state in Login Component
But I think a problem in it:
In "loginUser" function store in UserContext file
When call loginUser => we make change some of that state (Ex: error, isLoading, userDispatch)
this make warning render, because this work maybe Asynchronous ;
so browser could not optimization for render
And if setError(true) (before setIsLoading(false); or dispatch()) in loginUser
this browser render will not display error messenger
As we know, In Login file, using React userState hook for controll and display UI in view
But in page, we using loginUser function, from UserContext
This function using 6 parameter userDispatch, loginValue, passwordValue, props.history, setIsLoading, setError Some of this is arror function to change some state in Login Component
But I think a problem in it: In "loginUser" function store in UserContext file When call loginUser => we make change some of that state (Ex: error, isLoading, userDispatch) this make warning render, because this work maybe Asynchronous ; so browser could not optimization for render And if setError(true) (before setIsLoading(false); or dispatch()) in loginUser this browser render will not display error messenger