Skip to content

optimize state handlers #32

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

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

optimize state handlers #32

wants to merge 3 commits into from

Conversation

kqiq
Copy link

@kqiq kqiq commented Jan 1, 2023

hi im one of your old students that was attend in your class as guest in 2020 webdev that was a great experience for me .
i do some changes to this file for the following reasons :) :
The useMemo hook is not needed since initialValue is not a function that depends on props.
The spread operator ...props is removed since it is not used in the code.
The if (payload !== undefined) check is not needed since ...payload in the spread operator will automatically ignore undefined values.

Copy link
Author

@kqiq kqiq left a comment

Choose a reason for hiding this comment

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

The constructor method is removed and the storage property is initialized directly.
The isAvailable method is converted to an instance method by removing the static keyword.
The getFile and saveFile, getFileWriter methods are converted to async functions and the Promise constructors are replaced with await expressions.

Copy link
Author

@kqiq kqiq left a comment

Choose a reason for hiding this comment

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

The Boolean constructor is removed since the result of the logical OR operator || is already a boolean.

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.

1 participant