2022-12-06 17:45:10 +08:00
---
category: Components
group: Other
title: App
cover: https://gw.alipayobjects.com/zos/bmw-prod/cc3fcbfa-bf5b-4c8c-8a3d-c3f8388c75e8.svg
demo:
cols: 2
---
New App Component which provide global style & static function replacement.
## When To Use
Static function in React 18 concurrent mode will not well support. In v5, we recommend to use hooks for the static replacement. But it will make user manual work on define this.
## Examples
<!-- prettier - ignore -->
< code src = "./demo/message.tsx" > message< / code >
< code src = "./demo/notification.tsx" > notification< / code >
< code src = "./demo/modal.tsx" > modal< / code >
## How to use
2022-12-07 18:27:02 +08:00
```tsx
2022-12-06 17:45:10 +08:00
import React from 'react';
import { App } from 'antd';
2022-12-07 18:27:02 +08:00
const MyPage: React.FC = () => {
2022-12-06 17:45:10 +08:00
const { message, notification, modal } = App.useApp();
message.success('Good!');
notification.info({ message: 'Good' });
modal.warning({ title: 'Good' });
// ....
2022-12-07 18:27:02 +08:00
// other message, notification, modal static function
2022-12-06 17:45:10 +08:00
return < div > Hello word< / div > ;
};
2022-12-07 18:27:02 +08:00
const MyApp: React.FC = () => (
2022-12-06 17:45:10 +08:00
< App >
< MyPage / >
< / App >
);
2022-12-07 18:27:02 +08:00
export default MyApp;
2022-12-06 17:45:10 +08:00
```