Uncaught Error: seed(S) must take numeric argument; is string
FranciscoImanolSuarez opened this issue · 0 comments
FranciscoImanolSuarez commented
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