-
Notifications
You must be signed in to change notification settings - Fork 44
feat(hooks): add 'useIsClient' #219
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #219 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 33 34 +1
Lines 836 842 +6
Branches 254 256 +2
=========================================
+ Hits 836 842 +6 🚀 New features to boost your workflow:
|
We have similar discuss here: #202 |
|
I understand that distinguishing between the server and client environments is important,
|
Using This allows:
In React, a hook like |
@sukvvon I think using useSyncExternalStore would be a better approach since it avoids unnecessary re-renders compared to useEffect. Also, i think it follows React's recommended approach in a more standardized way, instead of relying on typeof window checks. What do you think?
|
If our library targets |
Overview
Checklist
yarn run fix
to format and lint the code and docs?yarn run test:coverage
to make sure there is no uncovered line?