diff --git a/src/components/SonComponent.js b/src/components/SonComponent.js index 04b2d64..941a9ff 100644 --- a/src/components/SonComponent.js +++ b/src/components/SonComponent.js @@ -6,7 +6,7 @@ export default class SonComponent extends React.PureComponent { state = { msg: "SonComponent Msg", showChildrenBorder: true, - childrenClass: [SonComponentCss.children] + childrenClass: [] } // constructor(props) { @@ -14,6 +14,10 @@ export default class SonComponent extends React.PureComponent { // console.log(props) // } + componentDidMount() { + this.changeChildrenClass() + } + switchChildrenBorder = () => { this.setState({ ...this.state, @@ -27,7 +31,6 @@ export default class SonComponent extends React.PureComponent { let childrenClass = [] if (this.state.showChildrenBorder) { childrenClass = [SonComponentCss.children] - } this.setState({