Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

331
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda