Skip to content

Glow - Mary and Gabriel #41

@Gabrielcruz1

Description

@Gabrielcruz1

export default function CharacterDetails() {
const { id } = useParams();
const url = https://rickandmortyapi.com/api/character/${id};
const [character, setCharacter] = useState({});
useEffect(() => {
fetch(url)
.then((res) => res.json())
.then((json) => {
setCharacter(json);
})
.catch(console.err);
}, []);

return (


{character.name}


Hello, my name is {character.name}.{" "}

I am currenltly {character.status}.



I am a {character.gender} {character.species}.

{" "}
I am from planet {character.origin?.name}.






);
}

This code snippet is from our CharacterDetails component. We are most proud of this code snippet because we were able to get the correct data from the api and manipulate that data in a format that we desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions