/fm02-interactive-rating

Frontend Mentor - Poject 02: Interactive rating with React

Primary LanguageJavaScript

Frontend Mentor - Interactive rating component solution

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.

Table of contents

Overview

The challenge

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

Screenshot

Links

My process

Built with

  • React
  • CSS custom properties
  • Flexbox
  • React - JS library

What I learned

I learned how to use css modules in React. CSS Modules let you use the same CSS class name in different files without worrying about naming clashes. I used enviroment variable for min and max rating number, I create and file .env with two variables

REACT_APP_NOT_MIN_RATING = 1
REACT_APP_NOT_MAX_RATING = 5

and in components I used this command:

  const min = process.env.REACT_APP_NOT_MIN_RATING;
  const max = process.env.REACT_APP_NOT_MAX_RATING;

Continued development

In future projects I want to use more React (props, context, hooks)

Useful resources

Author