Home > OS >  The star rating doesn't accept the value that we get from api
The star rating doesn't accept the value that we get from api

Time:08-31

I installed the star rating package in my reactjs code to display the star value that I get from the dummy API.

import { Rating } from "react-simple-star-rating";

But when I try to make it only read me, it becomes read only but when I try to add the value of my own.. it doesn't show any value.. example of code :

     <Rating
          ratingValue={product.rating} //this value doesn't applies to the star.. we get floating value in here..example 2.55 but it still don't work when I try giving actual value like 2,3,etc
          readonly={true} //it becomes read only
          initialValue="3" //this also doesn't work
        />

CodePudding user response:

try using a curly bracket instead of quotation

initialValue={3}
  • Related