How to update my UseEffect component to render new UI after a successful user login

Solution 1:

Your useEffect only runs once and that is right after the component has been loaded. Right now its not aware of any other changes since you have given empty dependency array to it. To suggest a solution in your case, why don't you just call

history.push("/application")

after you set the data to localStoare? That is after the line

localStorage.setItem("user", JSON.stringify(res.data));

and remove the useEffect