is there any way to show rating in spfx web part from list as star
1 Answer
If you're using React, you can use an NPM package like https://www.npmjs.com/package/react-star-ratings to do what you're looking for.
To use it:
- Add the NPM package to your project by using:
npm i react-star-ratings
- In your web part's component (where you render the content), add the following
import
:
import StarRatings from './react-star-ratings';
- In your
render
method, add the star rating control and pass the average rating:
<StarRatings
rating={2.403}
/>
Let us know if you're not looking at using an NPM package, or if you aren't using React.
I hope this helps.