diff --git a/packages/docs-app/src/examples/core-examples/panelStackExample.tsx b/packages/docs-app/src/examples/core-examples/panelStackExample.tsx index f16c50ee9c..68c3a67375 100644 --- a/packages/docs-app/src/examples/core-examples/panelStackExample.tsx +++ b/packages/docs-app/src/examples/core-examples/panelStackExample.tsx @@ -46,13 +46,13 @@ export class PanelStackExample extends React.PureComponent { - this.setState({ currentPanelStack: [newPanel, ...this.state.currentPanelStack] }); + this.setState(state => ({ currentPanelStack: [newPanel, ...state.currentPanelStack] })); }; private removeFromPanelStack = (_lastPanel: IPanel) => { // In this example, the last panel is always the one closed. // Using `this.props.closePanel()` is one way to violate this. - this.setState({ currentPanelStack: this.state.currentPanelStack.slice(1) }); + this.setState(state => ({ currentPanelStack: state.currentPanelStack.slice(1) })); }; }