2

This is my HTML file:

I'm starting with React-Create-App and modifying it. Some of the files are installed locally while Redux I'm trying to load in from a CDN.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <script src="cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.js"></script>
    <script src="fb.me/react-15.1.0.js"></script>
    <script src="fb.me/react-dom-15.1.0.js"></script>
    <title>React App</title>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

And then in my index.js file:

import React from 'react';
import ReactDOM from 'react-dom';
import { render } from 'react-dom'
import Counter from './Counter'

const { createStore } = Redux;
const store = createStore(Counter);

const comp = () => {
    ReactDOM.render(
    <Counter value={0}/>,
    document.getElementById('root')
)}

comp()

I keep getting the error:

Failed to compile.

./src/index.js
  Line 19:  'Redux' is not defined  no-undef

It works in Jsbin, but I can't get it to work on sublime. What am I doing wrong?

2 Answers 2

3

Try to import createStore from redux after installing it with npm

import { createStore } from 'redux';
Sign up to request clarification or add additional context in comments.

5 Comments

@MorganAllen, one more thing, prefer not to use cdn , you should gowith webpack
yea, trying to figure out how to update my package.json to include redux. Also I'm now getting the error: TypeError: createStore is not a function It doesn't look like I am importing creatStore correct?
npm install -S 'redux'
is there a way to do it through package.json?
Add ` "redux": "^3.6.0",` in package.json dependencies and tun npm install
0

Have you executed npm install to get react and all of it's dependecies? It may be a problem with that.

1 Comment

Yes. This works if I don't include anything from Redux

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.