Use Token from UserContext in Homepage Component
Closed this issue · 3 comments
lugenx commented
Refactor the Homepage
component to get the user token from UserContext
instead of directly from localStorage
.
Steps:
-
Replace
localStorage.getItem("token")
with thetoken
fromuseUserContext
.Remove:
const token = localStorage.getItem("token");
Update importing userContext to look like this:
const { user, setUser, token } = useUserContext();
-
Ensure the app's functionality remains unchanged.
Devrishi-Dutta commented
I want to do my first contribution, can you assign me this issue?
lugenx commented
assigned, thank you @Devrishi-Dutta . Let me know if you have any question.
Devrishi-Dutta commented
Am I supposed to do anything else after making the pull request? (in this issue )