This repository was archived by the owner on May 7, 2025. It is now read-only.
Converted App.js from class based component to functional component#158
Open
arunmishra2000 wants to merge 2 commits into
Open
Converted App.js from class based component to functional component#158arunmishra2000 wants to merge 2 commits into
arunmishra2000 wants to merge 2 commits into
Conversation
alaahatem
reviewed
Nov 14, 2021
Comment on lines
+79
to
90
| const loadUserInfo = () => { | ||
| // Get user details from localStorage and save to react store | ||
| try { | ||
| var info = localStorage.getItem("userInfo"); | ||
| let info = localStorage.getItem("userInfo"); | ||
| if (info) { | ||
| let userInfo = JSON.parse(info); | ||
| console.log("Loaded UserId from storage : " + userInfo.userId); | ||
| console.log("Loaded token from storage : " + userInfo.token); | ||
| this.props.setCurrentUser({ | ||
| props.setCurrentUser({ | ||
| userId: userInfo.userId, | ||
| token: userInfo.token, | ||
| }); |
There was a problem hiding this comment.
would be better if we just destructure the user info and use it to set the current user . use const instead of var or let
There was a problem hiding this comment.
try {
const info = localStorage.getItem("userInfo");
if (info) {
const {userId , token) = JSON.parse(info);
console.log("Loaded UserId from storage : " + userInfo.userId);
console.log("Loaded token from storage : " + userInfo.token);
this.props.setCurrentUser({
props.setCurrentUser({
userId,
token
});
alaahatem
reviewed
Nov 14, 2021
Comment on lines
+99
to
+101
| const onMenuToggle = () => { | ||
| setOverlay(!overlay); | ||
| }; |
There was a problem hiding this comment.
change this to
const onMenuToggle = () => setOverlay(!overlay);
alaahatem
suggested changes
Nov 14, 2021
alaahatem
left a comment
There was a problem hiding this comment.
Good Job but think some changes need to be applied first
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.