Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

ReactJs - Interactive Rating component

@saniyasaher20

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi, PLease help in this-> The focus and active psuedo class is working only after double clicking the rating button. but it should work on single click.

If I add "pointer-events: none;" to the button tag then the focus and active classes works fine but then react onClick event is not working. What shouldI do?

Community feedback

@JoyGHub

Posted

Hello Saniya!

The star in the circle above, and the numbers inside the rating buttons don't seem to be centered perfectly. Also, I wouldn't let the user submit without selecting a rating first.

Other than that, the component looks excellent!

Keep it up,

  • Stefan RIZEA

Marked as helpful

0

@saniyasaher20

Posted

@JoyGHub thanks, You're right, form shouldn't submit without rating. I will add that validation.

0
David 8,000

@DavidMorgade

Posted

The css :hover and :active can get buggy if they are used in the same element, try getting out of the active status and identify the clicked button using useState hook instead, you can use a function for each clicked button example:

const [isActive, setIsActive] = useState(false);

const handleClick = event => { setIsActive(current => !current); };

Hope it helps!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord