-
Notifications
You must be signed in to change notification settings - Fork 0
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
PR for #147 Refactor components to use functional components #148
base: main
Are you sure you want to change the base?
Conversation
Would be great to split this up into smaller PRs for 2 reasons:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed over this because it's a large PR, but overall looks good.
mounted: false, | ||
}; | ||
} | ||
const [language, setLanguage] = useState(getSavedLanguagePreference()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're using React v18+, we may be able to use useSyncExternalStore
, which provides a more robust method for reading data from external systems (like localStorage
). I wrote a blog post on this: https://www.arvinpoddar.com/blog/syncing-local-storage-with-react-state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion. I'll be sure to read your blog post for a more in-depth understanding.
|
||
handlePopoutOpen = (val) => { | ||
this.setState({ popoutOpen: val }); | ||
const handlePopoutOpen = (val) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: from a code clarity perspective, I'm of the opinion that it's preferable to have functions declared with function
, and reserve const
for computed values. Not required to change, just my two-cents (it's highly likely that at some in this code, I was also defining functions with const
).
7ecf415
to
7721787
Compare
Fix #147