We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ffa41bf commit bf504d3Copy full SHA for bf504d3
docs/src/components/ComponentDoc/ComponentDoc.js
@@ -34,15 +34,16 @@ class ComponentDoc extends Component {
34
state = {}
35
examplesRef = createRef()
36
37
- getChildContext() {
+ static getDerivedStateFromProps(props, state) {
38
return {
39
- onPassed: this.handleExamplePassed,
+ displayName: props.displayName,
40
+ activePath: props.displayName === state.displayName ? state.activePath : undefined,
41
}
42
43
- componentWillReceiveProps({ displayName }) {
44
- if (displayName !== this.props.displayName) {
45
- this.setState({ activePath: undefined })
+ getChildContext() {
+ return {
46
+ onPassed: this.handleExamplePassed,
47
48
49
0 commit comments