2

I have a main.js with

React.render(
        <h1>Hello, world!</h1>,
        document.getElementById('myDiv')
    );

I am using CodeKit, and it spits out the error: Unexpected token: operator (<). What am I missing that allows me to write HTML tags in my code?

Daniel
  • 93
  • 1
  • 1
  • 7

1 Answers1

0

You need to transform this piece of JSX into pure Javascript. I suggest you move from Codekit to Webpack, which can handle transformation, if configured.

Please, check this repository. It contains boilerplate code for React application. No configuration needed, just run the example
https://github.com/gaearon/react-transform-boilerplate

Bonus: it offers hot reloading, equivalent to Codekit's "reload on save", expect you don't loose state here! (page is not reloaded, JS is injected!)

Andreyco
  • 22,476
  • 5
  • 61
  • 65