branalex94 / interactive-rating-component

A frontendmentor challenge to create an interactive rating component. Made using react and vite as compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Finished Challenge!

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow
  • React - JS library
  • [Vite] (https://vitejs.dev/) - JS Bundler

What I learned

I learned how to create a multiple choice/unique choice selector using ReactJS.

const handleClick = (e) => {
  setRating(e.currentTarget.textContent);
  setIsRatingSelected(true);
};

useEffect(() => {
  if (rating === selectedRating) {
    setIsActive(true);
  } else {
    setIsActive(false);
  }
}, [selectedRating]);

Continued development

I'd like to focus on improving my code and maintaining it as clean as possible. As well as better use of frameworks and libraries features.

Author

About

A frontendmentor challenge to create an interactive rating component. Made using react and vite as compiler


Languages

Language:JavaScript 60.8%Language:CSS 31.3%Language:HTML 7.9%