Hello! In the class ’ Write a React Component from Scratch’, learning with ReactJS, the browser does not return the result of the exercise, the test keeps running! and a message is displayed that the page caused the browser to be slow! Only in this class has happened to me, any recommendations? I already tried with another browser, clear the cache and everything remains the same! Thanks
make sure you have not a loop with your components
for help,
post your code and the challenge link
Lesson:
Define a class MyComponent
that extends React.Component
. Its render method should return a div
that contains an h1
tag with the text: My First React Component!
in it. Use this text exactly, the case and punctuation matter. Make sure to call the constructor for your component, too.
Render this component to the DOM using ReactDOM.render()
. There is a div
with id='challenge-node'
available for you to use.
The code:
// Change code below this line
class MyComponent extends React.Component {
constructor(props){
super(props);
}
render(){
return(
<div id="challenge-node">
<h1>My First React Component!</h1>
ReactDOM.render(<MyComponent />, document.getElementById('challenge-node'));
</div>
);
}
}
The <h1>
was applied to the code
From already thank you very much!
you are rendereing MyComponent
inside itself, that makes an infinite loop and makes it not work
Thanks!!!