diff --git a/components/menu/MenuItem.tsx b/components/menu/MenuItem.tsx index 3ee55f1894..0bcb9f7c45 100644 --- a/components/menu/MenuItem.tsx +++ b/components/menu/MenuItem.tsx @@ -3,22 +3,22 @@ import { Item } from 'rc-menu'; import PropTypes from 'prop-types'; import Tooltip from '../tooltip'; -const MenuItem: any = (props, { inlineCollapsed }) => { - return ( - { + static contextTypes = { + inlineCollapsed: PropTypes.bool, + }; + static isMenuItem = 1; + render() { + const { inlineCollapsed } = this.context; + const props = this.props; + return - - ); -}; - -MenuItem.contextTypes = { - inlineCollapsed: PropTypes.bool, -}; - -MenuItem.isMenuItem = 1; + ; + } +} export default MenuItem; diff --git a/components/menu/__tests__/__snapshots__/demo.test.js.snap b/components/menu/__tests__/__snapshots__/demo.test.js.snap index 9a70e7daf9..cb6a608b45 100644 --- a/components/menu/__tests__/__snapshots__/demo.test.js.snap +++ b/components/menu/__tests__/__snapshots__/demo.test.js.snap @@ -582,7 +582,7 @@ exports[`renders ./components/menu/demo/switch-mode.md correctly 1`] = `