-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[charts] Rename useIsClient #16937
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
[charts] Rename useIsClient #16937
Conversation
Deploy preview: https://deploy-preview-16937--material-ui-x.netlify.app/ |
CodSpeed Performance ReportMerging #16937 will not alter performanceComparing Summary
|
Since it's my proposal, I let JS review. Maybe he will have better naming |
JS review: |
* | ||
* Basically a implementation of Option 2 of this gist: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85#option-2-lazily-show-component-with-uselayouteffect. */ | ||
export function useIsClient() { | ||
const [isClient, setIsClient] = React.useState(false); | ||
export function useIsHydrationDone() { |
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.
What about useIsClient
/useIsClientSide
? is hidration done
seems a bit too specific. 😆
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.
The issue is that we could do something like that and it would effectively returns true
only on client side
const useIsClient = () => widowns !== undefined
But that's not what we are looking for to avoid hydration missmatch
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 the issue is specifically for hydration then it makes sense.
Maybe useIsHydrationRender
or useIsHydrated
😩💧😁
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.
useIsHydrated
looks better! Renamed
Related to #16709 (comment)