ant-design/components/grid/demo/useBreakpoint.md
骗你是小猫咪 61d0d6b182
feat: useBreakpoint hook (#22226)
* feat: useBreakpoint hook

* update snapshots

* update snapshots

* update snapshots

* add useBreakpoint hook test
2020-03-15 20:53:23 +08:00

601 B

order title
10 useBreakpoint Hook

zh-CN

使用 useBreakpoint Hook 个性化布局。

en-US

Use useBreakpoint Hook povide personalized layout.

import { Row, Col, Grid } from 'antd';

const { useBreakpoint } = Grid;

function UseBreakpointDemo() {
  const screens = useBreakpoint();

  return (
    <Row>
      <Col>
        Current break point:&nbsp;
        {Object.entries(screens)
          .filter(screen => !!screen[1])
          .map(screen => screen[0])
          .join(' ')}
      </Col>
    </Row>
  );
}

ReactDOM.render(<UseBreakpointDemo />, mountNode);