diff --git a/components/menu/demo/switch-mode.md b/components/menu/demo/switch-mode.md
index 9931d492d9..1601bb7930 100755
--- a/components/menu/demo/switch-mode.md
+++ b/components/menu/demo/switch-mode.md
@@ -25,69 +25,61 @@ import {
const { SubMenu } = Menu;
-class Sider extends React.Component {
- state = {
- mode: 'inline',
- theme: 'light',
+const Demo = () => {
+ const [mode, setMode] = React.useState('inline');
+ const [theme, setTheme] = React.useState('light');
+
+ const changeMode = value => {
+ setMode(value ? 'vertical' : 'inline');
};
- changeMode = value => {
- this.setState({
- mode: value ? 'vertical' : 'inline',
- });
+ const changeTheme = value => {
+ setTheme(value ? 'dark' : 'light');
};
- changeTheme = value => {
- this.setState({
- theme: value ? 'dark' : 'light',
- });
- };
-
- render() {
- return (
- <>
-
-
-