Skip to the content.

Part 3. React hooks

<= BACK TO PART 2 (SASS)GO TO PART 4 (PROPS) =>

React.useState

  1. Create new component clickCount.tsx. Then initialize the component pattern using fcr snippet.
  2. Create click counter using THIS example.
  3. Add a new style class to your component by creating a new style file clickCount.module.scss.
  4. Change the background color of the container.
  5. Center the click counter button & value to the center of the Container.
  6. Import and place click counter component to App.tsx

React.useEffect

  1. Open clickCount.tsx
  2. Use useEffect hook to print to the console Clicked the button ${count} times every time, when value of count has changed.
    • useEffect examples HERE

More about hooks: https://reactjs.org/docs/hooks-reference.html

Remember to commit your code changes and push it to GitHub server

<= BACK TO PART 2 (SASS)GO TO PART 4 (PROPS) =>