material-tailwind icon indicating copy to clipboard operation
material-tailwind copied to clipboard

Rating is not reactive

Open devjs1000 opened this issue 2 years ago • 2 comments

Screenshot 2024-02-25 at 12 23 18 PM

even if the value changed to 0 it is not updating realtime. though other things are updating so it is not issue with re-renders.

 <div>
<Rating value={Math.floor(rating)} readonly />
 ({ratingCount})
</div>

devjs1000 avatar Feb 25 '24 06:02 devjs1000

Same issue did you find a fix?

tman16 avatar Jan 16 '25 17:01 tman16

Ok so I did a bit of trial & error and wrapping the component made it update on re-renders, no idea why so if someone can explain it that would be great otherwise heres the code:

const RatingWrapper = ({ readonly, value }) => {
        return (
          <Rating
            readonly={readonly}
            value={value}
          />
        );
 };

tman16 avatar Jan 16 '25 19:01 tman16