React Fundamentals

0% completed

Previous
Next
Code Challenge

Challenge: Show/Hide Secret Message

Follow these instructions to complete your challenge:

  1. Create a functional component called SecretMessage.
  2. Use state to track whether the message is visible (showMessage).
  3. Display a paragraph: "This is a secret message!" only when showMessage is true.
  4. Add a button to toggle the visibility of the message.
  5. The button should say "Hide" when the message is visible and "Show" when hidden.

Expected Output

Image

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next