import React from 'react';
import ReactDOM from 'react-dom';
class Car extends React.Component{
render(){
return <h1>This is a car</h1>;
}
}
ReactDOM.render(<Car />, document.getElementById('root'));
Getting Uncaught reference error when tried to run in react code pen.
CodePudding user response:
import React from 'react';
import ReactDOM from 'react-dom';
class Car extends React.Component{
//Your constructor here
render(){
return(
<h1>This is a car</h1>
)}
}
ReactDOM.render(<Car />, document.getElementById('root'));
CodePudding user response:
import * as React from "https://cdn.skypack.dev/[email protected]";
import * as ReactDOM from "https://cdn.skypack.dev/[email protected]";
Adding packages from react code pen settings fixed the issue !!