Questions tagged [react-key-index]

22 questions
0
votes
1 answer

Generating unique id's and for JSX element Nodes - React

Having a bit of a headache at the moment. I creating a quiz platform using React, and currently, I have a question component, which using , where inside that you can add however many 's as you like. However, I want to make these answers have unique…
0
votes
1 answer

React Error unique "key" prop. Although key is unique

I am going to take a list of movies and show them. Each movie has a unique value called id, and I want to use it as a key. But An error occurs : index.js:1 Warning: Each child in a list should have a unique "key" prop. --- Skip --- const Movie =…
Sh031224
  • 769
  • 1
  • 7
  • 20
0
votes
0 answers

Understanding the use of keys in React

I have this simple example of list rendering in React: render() { return (
    {this.state.cards.map(({ data }, index) => (
  • this.remove(index)}> {data}
0
votes
1 answer

What is causing the input box text not to re-order in the ReactJS page example of Reconciliation?

In the ReactJS page of Reconciliation, there are two examples: an example of the issues that can be caused by using indexes as keys an updated version of the same example showing how not using indexes as keys will fix these reordering, sorting, and…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
0
votes
2 answers

In ReactJS, using array index as key is said to not work well, but I can't make it not work well?

I can't make it not work well if I use index as the key. The only way is if I mutate the array and use index as the key. But since the docs says not to mutate the state (the array), so if that's the case, I can't make it not work well, contrary to…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
-1
votes
2 answers

react key prop error even tho keys are set

I'm getting this error I put the key prop everywhere they are needed: lists map functions but the error is still occurring, as you can see it says that error is occurring in method of "Rendered Route" I'm not sure what kind of component is that…
TheSillus
  • 19
  • 2
-1
votes
2 answers

I'm trying provide uuidv4 as key prop in my header list item but it gives me warning and asking unique key as prop

// This is my routes which I'm trying to map through const Header = () => { const routes = [ { id: 1, name: 'Home', link: '/' }, { id: 2, name: 'Blogs', link: '/blogs' }, { id: 3, name: 'Contact', link: '/about' } ]; //Since…
1
2