Got stuck in a "Build a Camper Leaderboard" assignment. Need help [Solved]

Hi everyone,

I see this error in the console when running my code:

Uncaught TypeError: Cannot read property ‘_currentElement’ of null).

It seems that the server data isn’t retrieved. I don’t understand what I’m doing wrong.

My code -

Hi, I see three problems with your code. First of all React requires <tbody> tag to enclose the <tr>. I forgot if it refuses to render if you forget or just complains, but thats number one. Then you do your ajax request in the componentWillMount method. I think you can only do synchronous stuff in there. It should work fine when you use the componentDidMount.

The last thing is that your render method on the LeaderboardRows class isn’t returning a React component. So you should take a look at that. Maybe do the not in the return, but assign your desired output to a variable and return that. If I find time I’ll try to give it a shot.

Hope this helps, happy coding :slight_smile:

1 Like

I added <tbody> in my code and it works now. Thanks. I strongly appreciate your helpful tips. :grinning:

Great :slight_smile: I would always use the non minified version of react when you’re developing. They have very helpful error msgs.
Take care

Is it possible to do so in

you can just grab them from the facebook page.
I included them in “my take” on your project.

Thanks! I will definitely do this in my next assignments.

Thanks this was super helpful to me too :slight_smile: I’m working on the Camper Leaderboard project right now and needed some tips - so thanks again. - Jessi