Which means the h1 the div and the
render DOM component should be in the return element
Yet when I try to do this is blanks out
Why? What am i doing wrong? Your code so far
// change code below this line
class MyComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
ReactDOM.render(<MyComponent/> , document.get.elementById('challenge-node');
<div>
<h1> My First React Component!</h1>
</div>
);
}
};
<div><h1> My First React Component!</h1></div>
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36.
Look carefully at that example. Yours is not the same: you have randomly mixed up where things go.
Nope, that’s not what the example you’ve posted shows. ReactDOM is a library for taking your React app and actually rendering it to the DOM. It has a function called render. But just because class components in React have a function called render doesn’t you have to put those two things together in the code.
Also, you can’t write HTML in a JS file. It’s not JS, it’s just a syntax error. JSX lets you write code that looks like HTML, but you have to do it in specific, allowed places in the code to allow the compiler to convert it to a normal JS function