mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
37 lines
601 B
Markdown
37 lines
601 B
Markdown
|
---
|
||
|
order: 10
|
||
|
title: useBreakpoint Hook
|
||
|
---
|
||
|
|
||
|
## zh-CN
|
||
|
|
||
|
使用 `useBreakpoint` Hook 个性化布局。
|
||
|
|
||
|
## en-US
|
||
|
|
||
|
Use `useBreakpoint` Hook povide personalized layout.
|
||
|
|
||
|
```jsx
|
||
|
import { Row, Col, Grid } from 'antd';
|
||
|
|
||
|
const { useBreakpoint } = Grid;
|
||
|
|
||
|
function UseBreakpointDemo() {
|
||
|
const screens = useBreakpoint();
|
||
|
|
||
|
return (
|
||
|
<Row>
|
||
|
<Col>
|
||
|
Current break point:
|
||
|
{Object.entries(screens)
|
||
|
.filter(screen => !!screen[1])
|
||
|
.map(screen => screen[0])
|
||
|
.join(' ')}
|
||
|
</Col>
|
||
|
</Row>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
ReactDOM.render(<UseBreakpointDemo />, mountNode);
|
||
|
```
|