I'm building a React APP to fetch movies and allow to comment them adding also vote/rate. The user can comment and vote for the movie.
What I did is to make an option
tag and use map
to create my rating values a user can choose.
This is a part of the code:
<FormGroup>
<Label for="rate">Rate(Out of 5)</Label>
<Input
type="select"
name="rate"
value={rate}
onChange={this.onChange}
style={{width: 200}}>
{ratings.map(rating => (
// eslint-disable-next-line react/jsx-key
<option>{rating}</option>
))}
</Input>
</FormGroup>
On the option tag line I'm getting the following error:
Warning: Each child in a list should have a unique "key" prop.
I have no idea how to take off of this warning and would like to have some suggestions also why I'm getting this so I can avoid it in the future.
My code fully is here: https://pastebin.com/qvReLYPy