How does this React component work?

I don’t understand what makes the text appear on click in this lesson. There must be some CSS behind making it appear, and visibility: true is not valid CSS as far as I know, so values of visible and hidden must be bound to the boolean value of state.visibility somehow. But how? What exactly makes the text appear?

It’s not CSS, it’s JS. The point is that the state of this.state.visibility determines which version gets rendered.

Change the first line of the render method to:

console.log('this.state', this.state)

to watch state change as you press the button.

I get it now, thank you. Somehow I missed that.

React is weird at first. But it’s really cool once you get the hang of it. And then Redux will be weird at first…