Article From:https://segmentfault.com/q/1010000011697394
Question:

visibleCan’t control the display and hide, always show on the page, I used to control the display and hide components, can’t control the Div.

Answer 0:

1、Modification status is not correct.

this.setState({
    QRList:!this.state.QRList,
})

Change into

this.setState(prevState => ({
    QRList: !prevState.QRList
}))

2、The visible you mention should be props for other people’s components, if you write it yourself, implemented or modified with the visibility of CSS

{this.state.QRList && (
    <div>
        The contents of the display...< /div>}

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *