Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Basics (2018) Thinking in Components Use a Component with JSX

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

Components without JSX

So how do I render the components, if I do not wanna use JSX.

ReactDOM.render(
    <Header />,
    document.getElementById('root')
);

So what would I put instead of <Header /> , If I am using the other Approach ?

2 Answers

Torben Korb
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Torben Korb
Front End Web Development Techdegree Graduate 91,390 Points
ReactDOM.render(
  React.createElement(Header, null),
  document.getElementById("root")
);

See React docs: https://reactjs.org/docs/react-without-jsx.html

Or try Babel REPL: https://babeljs.io/repl to see the transformation of any JSX code

Hope this helps. Happy coding!