Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

332
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda