We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
I came across this problem, researching on the internet I found a solution. Add parseInt, I leave the link of the information and the solution.
import React from "react"; import pet from "@frontendmasters/pet"; class Details extends React.Component { state = { loading: true }; componentDidMount() { pet .animal(parseInt(this.props.id)) .then(({ animal }) => { this.setState({ name: animal.name, animal: animal.type, location: `${animal.contact.address.city}, ${animal.contact.address.state}`, description: animal.description, media: animal.photos, breed: animal.breeds.primary, loading: false, }); }) .catch((err) => this.setState({ error: err })); } render() { if (this.state.loading) { return <h1>loading … </h1>; } const { animal, breed, location, description, media, name } = this.state; return ( <div className="details"> <div> <h1>{name}</h1> <h2>{`${animal} — ${breed} — ${location}`}</h2> <button>Adopt {name}</button> <p>{description}</p> </div> </div> ); } } export default Details;
More information https://ask.csdn.net/questions/6675117
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I came across this problem, researching on the internet I found a solution. Add parseInt, I leave the link of the information and the solution.
More information https://ask.csdn.net/questions/6675117
The text was updated successfully, but these errors were encountered: