diff --git a/site/theme/template/Content/Demo.jsx b/site/theme/template/Content/Demo.jsx index 73013f88007a..c3f47a735edb 100644 --- a/site/theme/template/Content/Demo.jsx +++ b/site/theme/template/Content/Demo.jsx @@ -17,6 +17,10 @@ export default class Demo extends React.Component { }; } + shouldComponentUpdate(nextProps, nextState) { + return (this.state.codeExpand || this.props.expand) !== (nextState.codeExpand || nextProps.expand); + } + handleCodeExapnd = () => { this.setState({ codeExpand: !this.state.codeExpand }); }