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

150
Views
return of a function inside a render method is undefined

I have a code that kinda looks like this: (I'm omitting some things but...)

render() {
(bunch of props and state)
 return (
  <div>
   <CustomTabs>
    {this.renderTabs()}
   </CustomTabs>
  </div>
}

Where the renderTabs function looks like this:

 renderTabs = () => {
   const { apps } = this.props;
   apps.filter(app => app?.id !== 'Dashboard').map((app, key) => {
     return <CustomTab label={app.id} key={key} />;
   });
  }

According to some console logs, the filter and mapping is working, so the label and the key exists and are set properly. But the return of the function is undefined.

I note that I'm using MUI datatables to do this and that if I delete the function and add multiple by hand instead, it works properly.

Why is this happening? I have lots of code that looks like this and lots of render methods that call another function to help the rendering and they work without problem.

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You need to return the result of filter

about 4 years ago · Santiago Trujillo Report

0

You need to return filtered items:

renderTabs = () => {
   const { apps } = this.props;
   return apps.filter(app => app?.id !== 'Dashboard').map((app, key) => {
     return <CustomTab label={app.id} key={key} />;
   });
  }
about 4 years ago · Santiago Trujillo 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!