Skip to content
New issue

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

Update Details #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update Details #137

wants to merge 1 commit into from

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
@@ -10,7 +10,7 @@ class Details extends React.Component {
state = { loading: true, showModal: false };
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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants