Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
Tabs: `key` is not a prop. Trying to access it will result in `undefined` being returned.?

I am getting this warning

Warning: Tabs: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it 

I am already passing key in my component .don't know where I am doing wrong.

here is my code https://codesandbox.io/s/priceless-edison-g09nz?file=/src/App.js

<Tabs>
      {data.reduce((result, tabItem, tabIndex) => {
        result.push(<Tab {...getTabItemProps(tabItem, tabIndex)} key={tabIndex}/>);
        return result;
      }, [])}
    </Tabs>

Tabs.js

 <>
    <ul className="rc64nav" ref={tabsRef}>
      {tabsVisible.reduce((result, tabItem, tabIndex) => {
        result.push(tabItem);
        return result;
      }, [])}

    </ul>
    <ul>
    <hr/>
    <div>break</div>
      <hr/>
      {tabsHidden.reduce((result, tabItem, tabIndex) => {
        result.push(tabItem);
        return result;
      }, [])}
    </ul>
    </>

Tab.js

import React from "react";

const Tabs = ({ title,hidden }) => {
  return <li className={hidden ? 'hidden':'not-hidden'}>{title}</li>;
};

export default Tabs;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I fixed the error: https://codesandbox.io/s/beautiful-sid-l9753?file=/src/tabs.js.

What I changed: I added a prop called tabKey. In App.js:

const getTabItemProps = (tabItem, tabIndex) => ({
  title: tabItem,
  key: tabIndex,
  tabKey: tabIndex
});

I made tabs.js reference tabKey instead of trying to use key as a prop:

const { tabKey = index } = tabItem.props;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!