I am using the rick and morty API to learn some things using the rest api. I have built crds out like they have with the character info on it. What I need to do is figure out how to include an episodes name array to the card as well. But it's a different API /episodes instead of /characters. I considered using an each as it went through but that seems really inefficient. I am using map inside the render of the component and have built a separate component for episodes, and again, it feel like that is making it more complicated. Just wondering what kid of strategy you might use to access the episodes and display them in a card.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (4)
Are you trying to replicate one of the libraries in the documentation?
The API uses pagination, so there will have multiple request. It'll require a processing time to gather all the info (characters and episodes), save it and facilitate it to a frontend. I'm not giving an answer but seems like a very interesting problem. I wonder about the graphQL part too.
The thing I am doing is just for learning. I need to have the stats on a card, much like they do in the libraries. I just have stats from Characters, now I want episode names. ONce i have the basics of that done I will move to drag and drop or other front end features I need for my upcoming project. But a fetch inside a fetch seems untidy.
Check this: rickandmortyapi.com/api/episode/1,...
Maybe you can make an array of the episodes' numbers and request them.
Doubt you'll require the episodes' details when you show a list of characters.
=) Quite a nice API to play with.
INdeed Carlos, I saw that and considered an ech for the characters as they are displayed, but it feels really inefficient. I had made a separate component. As far as whether I need it or not. I don't . I don't need any of this. I am trying to learn React, but perhaps I am best served to move on to other functionality instead of trying to find this solution. Which means I will be required to find this solution at work one day soon right? lol