Home > OS >  How to validate click one per browser?
How to validate click one per browser?

Time:09-16

How can i reduce raiting to be able to rate only once per browser?

I need to make validation for raiting component in React where client can rate only once per browser.

Here is example of the rating component:

export default function App() {
  const [value, setValue] = React.useState(0);
  return (
    <div>
      <Box component="fieldset" mb={3} borderColor="transparent">
        <Typography component="legend">Rate</Typography>
        <Rating
          name="pristine"
          value={value}
          onClick={(e) => setValue(e.target.value)}
        />
      </Box>
    </div>
  );
}

Here is sandbox link of the component Edit ancient-leaf-3131m

  • Related