There was an error while loading. Please reload this page.
1 parent cee78a5 commit 9d26779Copy full SHA for 9d26779
docs/src/components/ComponentDoc/ComponentProps/ComponentProps.js
@@ -16,16 +16,12 @@ export default class ComponentProps extends Component {
16
displayName: PropTypes.string.isRequired,
17
}
18
19
- state = {
20
- activeDisplayName: null,
21
- }
22
-
23
- componentWillReceiveProps(nextProps) {
24
- const currentName = this.props.displayName
25
- const nextName = nextProps.displayName
+ state = {}
26
27
- if (currentName.displayName !== nextName) {
28
- this.setState({ activeDisplayName: null })
+ static getDerivedStateFromProps(props, state) {
+ return {
+ displayName: props.displayName,
+ activeDisplayName: props.displayName === state.displayName ? state.activeDisplayName : null,
29
30
31
0 commit comments