Part 3. React hooks
<= BACK TO PART 2 (SASS) … GO TO PART 4 (PROPS) =>
React.useState
- Create new component
clickCount.tsx. Then initialize the component pattern usingfcrsnippet. - Create click counter using THIS example.
- Add a new style class to your component by creating a new style file
clickCount.module.scss. - Change the background color of the container.
- Center the click counter button & value to the center of the Container.
- Import and place click counter component to
App.tsx
React.useEffect
- Open
clickCount.tsx - Use useEffect hook to print to the console
Clicked the button ${count} timesevery time, when value ofcounthas 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