soniac
1
Tell us what’s happening:
Failing the last test- my class component isn’t rendering to the react DOM- why?
Your code so far
// change code below this line
class MyComponent extends React.Component {
constructor(props) {
super(props)
}
render() {
return <h1>My First React Component!</h1>
}
}
ReactDOM.render(
MyComponent,
document.getElementById('challenge-node')
);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
.
Challenge: Write a React Component from Scratch
Link to the challenge:
Sky020
2
Welcome, soniac.
I suggest you go over the previous lesson once more: https://www.freecodecamp.org/learn/front-end-libraries/react/render-a-class-component-to-the-dom
You are not quite passing the component to the ReactDOM.render
method correctly.
Hope this helps
Hi!
in ReactDOM.render try to use :
<MyComponent />
instead of only: MyComponent.
1 Like
soniac
4
Ah thank you! It was so obvious!
1 Like