question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Missing "key" prop for element in array react/jsx-key

See original GitHub issue

When deploying on Vercel I get this deployment error.

I use this Table Component:


<Table
      columnsConfig="80px 3fr 2fr 2fr 80px"
      data={dataFeed3}
      header={[
        '',
        <span>Fight</span>,
        <span>Staked</span>,
        <span>Action</span>,
        ''
      ]}
      maxPages={3}
      onPageNumberChanged={function noRefCheck(){}}
      pageSize={5}
    />

Data to the data object goes from this:


const dataFeed3 = stakedFights
    .map((stakedFights, index) => [<span key={index}></span>, <Link href="/fights/[address]" as={`/fights/${stakedFights.contract}`}>{`Fight `+stakedFights.contract.substring(0,6)+`...`+stakedFights.contract.substring(38,42)}</Link>,
    <span>{Math.floor(Web3.utils.fromWei(((stakedFights.Staked).toString()), 'ether'))+` SLICE`}</span>,
    <Button variant='outline-secondary' onClick={()=>onUnstake(stakedFights.Staked, stakedFights.contract)}>Unstake</Button>, ''])

As you can see I use the key prop in the array, so I am stuck here.

Please help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
spavlovic77commented, Feb 10, 2022

Thank you @locothedev very much for helping. It works now.

2reactions
locothedevcommented, Feb 10, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint: Missing "key" prop for element in iterator (react/jsx-key)
Please take a time to notice that the Col element have an unique key. Indeed, person.id is unique throughout the map loop.
Read more >
jsx-key `Missing "key" prop for element in array` when there is ...
Hello,. I just upgraded eslint-plugin-react from 7.28.0 to 7.29.0. The result is I now get a Missing "key" prop for element in array...
Read more >
react_missing_key_prop - Rule | DeepScan
This rule applies when key prop is missing at each element inside the children of a React element. In React, rendering is optimized...
Read more >
How to Fix 'Each child should have a unique key prop' - Webtips
The "Each child in a list should have a unique "key" prop." warning happens in React when you create a list of elements...
Read more >
Lists and Keys - React
Keys help React identify which items have changed, are added, or are removed. Keys should be given to the elements inside the array...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found