Skip to content

Conversation

@FranciscoImanolSuarez
Copy link

Dear, as an attachment in the problem #136 when you throw this error, the way I found on the internet to solve it is with parseInt.

I am looking forward to your response.

#136

Dear, as an attachment in the problem #136 when you throw this error, the way I found on the internet to solve it is with parseInt.

I am looking forward to your response.




#136
componentDidMount() {
pet
.animal(this.props.id)
.animal(parseInt(this.props.id))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget the radix. You want to make sure that it gets parse to base 10.

parseInt(this.props.id, 10)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

And actually in this case, I believe it would be more appropriate to use Number()

Number(this.props.id)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you say sounds good. @btholt What do you think ?

In case you decide by Number I modify it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants