Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted App.js from class based component to functional component #158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

arunmishra2000
Copy link

No description provided.

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,
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

@alaahatem alaahatem Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 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
        });

Comment on lines +99 to +101
const onMenuToggle = () => {
setOverlay(!overlay);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to
const onMenuToggle = () => setOverlay(!overlay);

Copy link

@alaahatem alaahatem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job but think some changes need to be applied first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants