Getting React to work in CodeKit

Getting React to work in CodeKit
0

#1

Hi everyone!

I’m trying to get React up and running on CodeKit, but CodeKit doesn’t seem to recognize the React syntax.

My react file, called index.js looks like this:

const JSX = <h1>Hello World!</h1>;
ReactDOM.render(JSX,document.getElementById('greeting-div'));

My index.html file looks like this:

<body>
<div id="greeting-div"></div>
<script type="text/babel" src="src/index.js"></script>
</body>

I use CodeKit 3.0 to Check Syntax and Process index.js. I am Transpiling With Babel and Checking Syntax with ESLint. Under my Babel settings I have “React” enabled as a preset.

When I Check Syntax I get “Parsing error: Unexpected token <” referring to the opening carrot in const JSX = <h1>Hello World!</h1>;

Any idea what I am missing? Babel simply appears not to recognize the JSX syntax.

Thanks so much for your help!