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

330
Views
How to get episode name where the character appeared for the first time? (Rick&Morty api)

I'm trying to create Rick&Morty page like the original Rick&Morty-api

But I have problems with the First seen in: line , where you can see on which episode the character appeared for the first time.

I've used useEffect to get all characters and rendered them. It was the easest part, but I don't understand how to get name of episodes , where character appears for the 1st time. And It should work on each page, when I change my page by my pagination. Maybe I should match episodes id with characters id. I really want to work out this problem. So please direct me somehow:)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You already have a list of episodes which should contain the episode id and name. You already get the episode id from character.match, so you should be able to do something like:

let episodeName = episodes.find(e => e.id == character.episode[0].match(/\d+/)[0]).name;

For the particular context of your output jsx, I think this will work:

<h3 className="character_location">
  {episodes.length > 0 && episodes.find(e => e.id == character.episode[0].match(/\d+/)[0]).name}
</h3>
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!