Stuck on JSX Variables Exercise


Hi there, I've had a search around and couldn't find anyone else that's had the same problem.

I keep getting the same error, I've followed the instructions properly and have gone back to check I'm using ReactDOM.render correctly. No idea what I'm doing wrong!

Any help would be awesome,



ReactDOM.render's first argument should be < h1 >{theBestString} < /h1 >. (I've added spaces in the h1 tags when posting here to prevent formatting)

var React = require('react');
var ReactDOM = require('react-dom');

var theBestString = 'tralalalala i am da best';

var greeting = <h1>{theBestString}</h1>;



This is easy! The workspace is pretty clear on this, announcing:

ReactDOM.render's first argument should be <h1>{theBestString}</h1>.

But your first argument for ReactDOM.render() is greeting because you unnecessarily put it in an additional var.

This is okay in reality, but the workspace seems to check the first argument passed to ReactDOM.render().


Ah right, didn't realise you could put html tags directly in as an argument, thought they had to be put into a var first judging from the example on the page that does just that.

Thanks for the help!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.