Skip to content

Conversation

@atzcl
Copy link
Contributor

@atzcl atzcl commented Mar 2, 2021

fix the useLayoutEffect warning of nextjs

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

@vercel
Copy link

vercel bot commented Mar 2, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/input-number/8eCgAbQhcgG95rES7ego58SQShXA
✅ Preview: https://input-number-git-fork-atzcl-master-react-component.vercel.app

@codecov
Copy link

codecov bot commented Mar 2, 2021

Codecov Report

Merging #297 (51c7c24) into master (851269f) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
src/InputNumber.tsx 98.17% <100.00%> (+0.01%) ⬆️
src/hooks/useLayoutEffect.ts 100.00% <100.00%> (ø)
src/hooks/useUpdateEffect.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 851269f...fdd83b3. Read the comment docs.

@@ -0,0 +1,5 @@
import * as React from 'react';

const isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zombieJ zombieJ merged commit 9916935 into react-component:master Mar 11, 2021
@zombieJ
Copy link
Member

zombieJ commented Mar 11, 2021

+ rc-input-number@7.0.1

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.

Warning: useLayoutEffect does nothing on the server

2 participants