Feb 19, 2021
Let’s Make Text Disappear in React!
Hey, you! Yes, you! Want to make text disappear in React? Let’s do it.
First, we can set something like “show” to true in state.
Then let’s write a textDisappear function. When we set state, we’ll set show to the opposite of show using a bang operator.
Next, we’ll write out a ternary. When we click on the button, it will say, “Hello there!” Otherwise, null.
Lastly, we’ll make a button. First, pass the textDisappear function into the onClick. Then we can make the button say something like, “Click for a message!”
That’s it! Try it out, and don’t get discouraged.