btholt / btholt/complete-intro-to-react-v5

Uncaught Error: seed(S) must take numeric argument; is string

Open
#136 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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

loading …

;
}

const { animal, breed, location, description, media, name } = this.state;

return (



{name}


{`${animal} — ${breed} — ${location}`}


Adopt {name}

{description}




);
}
}

export default Details;

```

More information https://ask.csdn.net/questions/6675117

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the Details component and inspect the pet.animal call that receives this.props.id. Confirm that the animal lookup receives a numeric id, then verify that the details view loads without the seed(S) error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.