1. Introduction to React
Challenge: useState Hook
Create a component that includes a button and a text paragraph. Implement the necessary logic using the
useState hook to toggle the visibility of the text paragraph when the button is clicked.
The task is:
- Import the correct hook from the React library.
- Set the correct state variable taking in account the function name.
- Use the reference to the function to react on the button click.
2. For this task, we will utilize the
useStatehook as we are managing the state of paragraph visibility.
3. To determine the appropriate variable name for the state, observe the function associated with setting the state
setIsVisible. Remove the "set" prefix and use a lowercase first letter for the variable name.
4. To invoke the function when the button is clicked, assign the function name as the value for the
Everything was clear?