0

I have index.js like this

import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import Login from './containers/Login'
import configureStore from './store/configureStore'

const store = configureStore()

render(
    <Provider store={store}>
        <Login />
    </Provider>,
  document.getElementById('root')
)

when I build this with npm run build it gives me syntax error. What might be wrong in here ?

4
  • Could you add the syntax error? Commented Jan 25, 2016 at 11:57
  • render( > 10 | <Provider store={store}> | ^ 11 | <Login /> 12 | </Provider>, 13 | document.getElementById('root') Commented Jan 25, 2016 at 12:08
  • Looks like it doesn't know how to process JSX. Are you sure you really transpile your JSX in your index.js? Commented Jan 25, 2016 at 12:09
  • I dont think I am using jsx Commented Jan 25, 2016 at 12:18

1 Answer 1

1

You are using JSX, so you must transpile them (I would suggest using Babel, which can transpile both JSX and ES6).

Otherwise, you could go without JSX using this

render(
  React.createElement(Provider, {store: store},
    React.createElement(Login, {})
  ),
  document.getElementById('root')
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.