Skip to content
Advertisement

why is MUI CORE basic rating code is giving me setValue as undefined?

i tried using MUI CORE for first time and it’s giving me arror as i wanted to use active first rating and set value is not defined

i

JavaScript
JavaScript
JavaScript

Advertisement

Answer

Ey!

The only thing that i can see is that you are trying to use “setValue” in the “onChange” event handler for the “Rating” component, but there is not a “setValue” defined, so maybe that’s the problem.

Here is a possible solution:

JavaScript

useState hook is used to create a state variable called “value” with an initial value of “3”. setValue function is used to update the value of the “value” state variable when “onChange” event is fired.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement