Tell us what’s happening:
So I am trying to run my code in chrome browser and it would not show anything. I have recently downloaded React to practice some of the examples. When I write the code below on Scrimba.com it works fine. But not on my desktop. Am I missing something when I downloaded the React. I am using Visual Studio Code for editing. Please help.
Your code so far
import React from "react"
import ReactDOM from "react-dom"
//JSX is javascript rendition of html
ReactDOM.render(<h1>Hello World!</h1>,document.getElementById("root"))
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
itemCount: 0
};
// change code below this line
// change code above this line
}
addItem() {
this.setState({
itemCount: this.state.itemCount + 1
});
}
render() {
return (
<div>
{ /* change code below this line */ }
<button>Click Me</button>
{ /* change code above this line */ }
<h1>Current Item Count: {this.state.itemCount}</h1>
</div>
);
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge: