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

Solution #2668

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #2668

wants to merge 1 commit into from

Conversation

Oleh0293
Copy link

@Oleh0293 Oleh0293 commented Aug 2, 2023

No description provided.

Copy link

@Moroz-Dmytro Moroz-Dmytro left a comment

Choose a reason for hiding this comment

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

Well done 👍
But check advice for the future

Comment on lines +11 to +25
case 'addProperties':
Object.assign(state, action.extraData);
break;
case 'removeProperties':
for (const key of action.keysToRemove) {
delete state[key];
}
break;
case 'clear':
for (const key in state) {
delete state[key];
}
break;
default:
return 'Unexpected error';

Choose a reason for hiding this comment

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

Suggested change
case 'addProperties':
Object.assign(state, action.extraData);
break;
case 'removeProperties':
for (const key of action.keysToRemove) {
delete state[key];
}
break;
case 'clear':
for (const key in state) {
delete state[key];
}
break;
default:
return 'Unexpected error';
case 'addProperties':
Object.assign(state, action.extraData);
break;
case 'removeProperties':
for (const key of action.keysToRemove) {
delete state[key];
}
break;
case 'clear':
for (const key in state) {
delete state[key];
}
break;
default:
return 'Unexpected error';

Choose a reason for hiding this comment

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

It's easier to read. But even better would be to use curly braces(read more here)

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.

2 participants