ant-design/ant-design

Grid.useBreakpoint is empty on initial render

Aperta

#32.533 aperta il 17 ott 2021

 (7 commenti) (9 reazioni) (1 assegnatario)TypeScript (54.612 fork)batch import
Inactivehelp wanted

Metriche repository

Star
 (98.031 stelle)
Metriche merge PR
 (Merge medio 3g 4h) (248 PR mergiate in 30 g)

Descrizione

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. consume Grid.useBreakpoint();
  2. initial render will display empty object

What is expected?

I would expect Grid.useBreakpoint() to return an initial value on the first render. This could also potentially not rerender a component consuming Grid.useBreakpoints().

You could initiate it by checking window.innerWidth on mount.

I would be happy to create a PR for this.

What is actually happening?

initial render of Grid.useBreakpoint() displays an empty object

Environment Info
antd 4.16.13
React 17.0.2
System macOs BigSur
Browser Firefox 93.0

Guida contributor