diff --git a/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.js b/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.js index 88ff621051..6564b34805 100644 --- a/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.js +++ b/docs/src/components/ComponentDoc/ComponentProps/ComponentProps.js @@ -16,16 +16,12 @@ export default class ComponentProps extends Component { displayName: PropTypes.string.isRequired, } - state = { - activeDisplayName: null, - } - - componentWillReceiveProps(nextProps) { - const currentName = this.props.displayName - const nextName = nextProps.displayName + state = {} - if (currentName.displayName !== nextName) { - this.setState({ activeDisplayName: null }) + static getDerivedStateFromProps(props, state) { + return { + displayName: props.displayName, + activeDisplayName: props.displayName === state.displayName ? state.activeDisplayName : null, } }