How to use Rating Component in ReactJS ? Last Updated : 05 Aug, 2024 Comments Improve Suggest changes Like Article Like Report Rating Component helps capture the user feedback in form of rating. With the help of this feature, users can also rate the products they have purchased. Material UI for React has this component available for us, and it is very easy to integrate. We can use the following approach in ReactJS to use the Rating Component.Creating React Application And Installing ModuleStep 1: Create a React application using the following command:npx create-react-app foldernameStep 2: After creating your project folder i.e. foldername, move to it using the following command:cd foldernameStep 3: After creating the ReactJS application, Install the material-ui module using the following command:npm install @material-ui/corenpm install @material-ui/labProject Structure: It will look like the following.Project StructureExample: Now write down the following code in the App.js file. Here, App is our default component where we have written our code. App.js import React from 'react'; import Rating from '@material-ui/lab/Rating'; import Typography from '@material-ui/core/Typography'; import Box from '@material-ui/core/Box'; export default function App() { const [ratingValue, setRatingValue] = React.useState(0); return ( <div style={{ display: 'block', padding: 30 }}> <h4>How to use Rating Component in ReactJS?</h4> <Box component="fieldset" mb={3} borderColor="transparent"> <Typography component="legend"> Please Rate our app </Typography> <Rating name="Rating Label" value={ratingValue} onChange={(event, newValue) => { setRatingValue(newValue); }} /> </Box> </div> ); } Step to Run Application: Run the application using the following command from the root directory of the project:npm startOutput: Now open your browser and go to http://localhost:3000/, you will see the following output:Reference: https://material-ui.com/components/rating/ Comment More infoAdvertise with us Next Article How to use Rating Component in ReactJS ? G gouravhammad Follow Improve Article Tags : JavaScript Web Technologies ReactJS Material-UI Similar Reads How to create a rating component in ReactJS ? Creating a rating component in React application allows user to register their review and rate the items using clickable stars. Using a custom rating component enhances the UI and experience of users.Prerequisite:Basic knowledge of npm or yarn.styled-components.Basic Knowledge of useState React hook 3 min read How to use Badge Component in ReactJS? Badge generates a small badge to the top-right of its children component. Material UI for React has this component available for us, and it is very easy to integrate. We can use the Badge Component in ReactJS using the following approach. Prerequisites:NodeJS or NPMReact JSMaterial UISteps to Create 2 min read How to use XGrid Component in ReactJS ? An XGrid Component is a Commercial version of the MaterialUI Component. It provided more enhanced features over the community DataGrid Component like column resizing, column reordering, pagination over 100 rows, etc. A DataGrid Component helps in displaying the information in a grid-like format of r 3 min read How to create components in ReactJS ? Components in React JS is are the core of building React applications. Components are the building blocks that contains UI elements and logic, making the development process easier and reusable. In this article we will see how we can create components in React JS. Table of Content React Functional C 3 min read ReactJS Onsen UI Radio Component ReactJS Onsen-UI is a popular front-end library with a set of React components that are designed to developing HTML5 hybrid and mobile web apps in a beautiful and efficient way. Radio Component allows the user to select one option from a set. We can use the following approach in ReactJS to use the O 2 min read Like