Syntax Error


#1

I need to say if my code is good

01 import React {Component} from 'react';
02 import ReactDOM from 'react-dom';
03 
04 class MyComponentClass extends React {
05  render() {
06    return <h1>Hello world</h1>;
07  }
08 }
09
10 ReactDOM.render(
11 <MyComponentClass />,
12 document.getelementById('app')
13 );

I have an error :

Oops! The test returned an error. Maybe you have a syntax error, or a typo. See full error.

/home/ccuser/node_modules/babel-core/lib/transformation/file/index.js:590
SyntaxError: /home/ccuser/workspace/react-101-your-first-react-component-hello-world-component/app.js: Unexpected token (1:13)


#2

I have found my errors, it should be to find a little :stuck_out_tongue:

import React, {Component} from 'react';
import ReactDOM from 'react-dom';

class MyComponentClass extends React.Component {
  render() {
    return <h1>Hello world</h1>;
  }
}

ReactDOM.render(
  <MyComponentClass />,
  document.getElementById('app')
);

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.