Hi
Social Network for Pets complete Project using React Components using classes.
Cheers
Hi
Social Network for Pets complete Project using React Components using classes.
Cheers
Hi, author of this project. I hope you enjoyed it!
Your code is almost exactly the same as my solution, so well done! I’ve got almost no negative feedback because you did such a good job, but here are two points:
The first point: you’re not canceling the fetch in componentDidUpdate()
. That means that there might be some strangeness with the data. For example, consider this sequence of events:
Right before you call loadUserData()
in componentDidUpdate()
, you should make sure to cancel the fetch with cancelFetch(this.fetchID)
. That way, you “clean up” old requests.
The second point is much smaller, and is more of a nitpick. This line could be shortened:
const isLoading = this.state.userData === null ? true : false;
Because this.state.userData === null
evaluates to a boolean, you could do something a little shorter:
const isLoading = this.state.userData === null;
Again, you did great, and I love your solution. I hope my minor comments don’t take away from the fact that your solution is nearly perfect!
Not sure if anyone else was wondering about this, but after Step 6 I wasn’t able to see the sample value for bio while the profile was loading. All I saw was a grey box before the this.state.userData.bio
populated. I wondered if there was an issue with my code, but since this.state.userData.bio
populated correctly realized it must be something else. I dug around and found this happens because in styles.css there is a CSS selector for .Profile.loading p
that sets the background to the same color as the font for .Profile.loading
. If you comment out or delete the .Profile.loading p
selector, you’ll be able to see your sample value!
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.