diff --git a/components/popover/demo/hover-with-click.md b/components/popover/demo/hover-with-click.md index c507e81149..3f7933bc8a 100644 --- a/components/popover/demo/hover-with-click.md +++ b/components/popover/demo/hover-with-click.md @@ -16,29 +16,16 @@ The following example shows how to create a popover which can be hovered and cli ````jsx import { Popover, Button } from 'antd'; -const hoverContent = ( -
- This is hover content. -
-); - -const clickContent = ( -
- This is click content. -
-); - -const initalState = { - clicked: false, - hovered: false, -}; - class App extends React.Component { - state = initalState; + state = { + clicked: false, + hovered: false, + }; hide = () => { this.setState({ - ...initalState, + clicked: false, + hovered: false, }); } @@ -57,9 +44,18 @@ class App extends React.Component { } render() { + const hoverContent = ( +
+ This is hover content. +
+ ); + const clickContent = ( +
+ This is click content. +
+ ); return ( Close]} + content={( +
+ {clickContent} + Close +
+ )} title="Click title" trigger="click" visible={this.state.clicked}