react-component / react-component/util

useMobile hooks in version v5.28.0

Open
#431 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
670
Forks
205
Avg merge
11d 17h
Merged PRs (30d)
4

Description

Env:

  • use Remix with antd
  • React SSR(node)
  • InputNumber Component dep the rc-utils
  • rc-utils v5.28.0 add useMobile hooks, in useMobile call useLayoutEffect, useLayoutEffect called in ssr node env, so react-dom give a useLayoutEffect warning.

Since useLayoutEffect, a warning is issued, consider using useEffect? Otherwise, if it is used in SSR, you will always be warned.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the useMobile hook introduced in rc-utils v5.28.0 and inspect how it calls useLayoutEffect during React SSR in the reported Remix/Node environment. Reproduce the server-rendering warning, then verify that the hook no longer emits it while its client-side behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.