This is a solution to the Interactive rating component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the app depending on their device's screen size
- See hover states for all interactive elements on the page
- Select and submit a number rating
- See the "Thank you" card state after submitting a rating
- Live Site URL: Vercel
- ReactJS
- Typescript
- CSS Module
- React Testing Library (RTL)
-
useState
hook- Allows us to add state to a function component
-
CSS module
- Classnames and animation names are locally scoped
- Different components can be using the same class name but have different css properties
- It is recommended to use
camelCase
to avoid facing unexpected behavior example when trying to access akebab-case
classname in JS
-
React Testing Library
- Allows us to import and render the component for testing
- Important to test what user sees/interacts with on the website instead of the logic behind the components
-
Typescript
- Reduce bugs by doing static type checks when passing arguments into methods