相关文章推荐

You should put the key on the outer element:

const peopleCard = this.state.people.map(person => (
  <Col key={person.id} sm="4">
    <PeopleCard person={person} />
                                            
sometime it still give issue if your two key values get match so better use this way.
 render() {
let peopleCard = this.state.people.map((person, index) => {
  return (
    <Col sm="4" key={`${person.id}+${index}`}>
      <PeopleCard key={person.id} person={person} />
return (
  <Container fluid>
    <Row>{peopleCard}</Row>
  </Container>

were no two loop will have same id with index which can make key value different.

  • React esLint error: Missing "key" prop for element in array
  • Missing "key" prop for element in iterator react/jsx-key in React
  • React project script linter error Missing "key" prop for element in iterator
  • eslint: Missing "key" prop for element in iterator (react/jsx-key)
  • React Dumb component Typescript error: Element is not a constructor function for JSX elements, property 'render' is missing
  • Missing "key" prop for element in iterator and Prop spreading is forbidden
  • React JSX: Iterating through a hash and returning JSX elements for each key
  • Using JS React component in TypeScript: JSX element type 'MyComponent' is not a constructor function for JSX elements
  • Different ways to add a key to JSX element in loop in React
  • Can you add a key to a React JSX Element after it's instantiated?
  • In React how to add key prop to element passed as Object
  • ESLint React PropTypes, 'prop' is missing in prop validation
  • babelify transformation on JSX for React element failing
  • react , missing unique key for map iteration
  • Highlight React JSX element for array of keywords
  • Ionic React JSX element type 'false | Element' is not a constructor function for JSX elements. Type 'false
  • How to pass as prop for a React Element an object that has a huge number of properties?
  • Missing "key" prop for element in iteratoreslintreact/jsx-key
  • How can I change a prop on a React Element saved in an Array? JSX
  • I am missing a key ID for React button onClick
  • Where am I missing a key prop here? I'm generating uuids for TableCell keys and I'm using row.id for the row keys
  • Create a key handler for input element with React and TypeScript
  • React component is not accepting JSX Element as prop
  • How can i generate a unique key for my key prop inside a map? React
  • React eslint error missing in props validation on for the word "props"
  • How to catch react errors like use className instead of class or key missing for a loop while linting without ejecting cra
  • onClick attribute for JSX react element not working as expected
  • React PropTypes: Allow different types of PropTypes for one prop
  • React prop validation for date objects
  • React eslint error missing in props validation
  • More Query from same tag

  • Suspense component gets called before the data actually loads
  • How to combine RxDB and MobX
  • Make Blacklist JWT tokens for spring boot
  • How to add a data-testid to a table row in antd?
  • what is different between promise vs async when I use redux-thunk?
  • Animation in react-dnd
  • Iterating over array inside object in JSX giving undefined
  • React unique key prop
  • How do I test an onKeyDown event on the whole document page for a pop up?
  • Access a viewbag property in reactjs
  • React: duplicate values only display on first item in material ui table
  • This is a React JS Fetch with a failing POST method
  • how do i get the link from my uploaded file to firebase to pass to img element?
  • React Material-UI Autocomplete customize `no options` text
  • Do not nest ternary expression - alternative
  • How to embed :id parameter in the middle of a URL in react router
  • Jest matcher to match any one of three values
  • React + ASP.Net-Core CORS Problems
  • How to trigger React to re-render from outside
  • DateRangePicker material ui value formatting
  • ReactJS: Okta Auth RestoreOriginalUri Function not Redirecting
  • How to access this.context.router (ReactJS)
  • Passing state value to mapDispatchToProps in React Redux
  • Way to iterate with different grid sizes
  • why wont jsx render firestore data
  • Django Models: Accessing Parent Object Attribute Within a Related Object Using OneToOneField
  • Make multiple pages in ReactJS without using react-dom-router
  • Open PDF in React with correct title
  • How to handle async state updates in react
  • Click to apply style to an element whilst removing from others
  •  
    推荐文章