ant-design/ant-design

Grid.useBreakpoint is empty on initial render

Open

#32,533 创建于 2021年10月17日

在 GitHub 查看
 (7 评论) (9 反应) (1 负责人)TypeScript (98,031 star) (54,612 fork)batch import
Inactivehelp wanted

描述

  • 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

贡献者指南