Skip to content
Advertisement

Show and hide div in react js

How do I hide my page “section” when I click on a button. and show it another button is clicked Here’s my code

JavaScript

how do i make the onClick event work it out?

Advertisement

Answer

Just set a state let’s call it for example hide and set default value false, and on the button click turn it to true.

And you can conditionally hide the button section and show the info section.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement