-
-
Notifications
You must be signed in to change notification settings - Fork 185
feat(useUpdateEffect): support ssr #297
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
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/input-number/8eCgAbQhcgG95rES7ego58SQShXA |
Codecov Report
@@ Coverage Diff @@
## master #297 +/- ##
==========================================
+ Coverage 97.22% 97.24% +0.01%
==========================================
Files 7 8 +1
Lines 397 399 +2
Branches 105 107 +2
==========================================
+ Hits 386 388 +2
Misses 11 11
Continue to review full report at Codecov.
|
src/hooks/useLayoutEffect.ts
Outdated
| @@ -0,0 +1,5 @@ | |||
| import * as React from 'react'; | |||
|
|
|||
| const isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement; | |||
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.
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.
@zombieJ ok
|
|
fix the
useLayoutEffectwarning ofnextjs:Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.close #302