How to add React-Redux to my project?

Hi! I’m starting on the quote machine project and very easily figured out how to add React to my project, but do not understand at all how to add react-redux to my project? I’ve looked at what has to be a dozen tutorials for it and literally it read like absolute gibberish to me, which is kind of telling me the challenges alone did not prepare me at all for this part of the process. Most of the tutorials boil down to “just install npm install --save react-redux” but I don’t know what that really entails at all? I’ve got my html, css, and js files open in VSCode and I don’t know where I would install anything at all. I’m not asking to be hand-held here but I really need like, an idea of the direction I should be heading in. What should I be learning so this isn’t greek to me?

How have you added React to your project? Did you use npm to install it, or are you using <script> tags in your HTML? If it’s the latter, I’d urge you to learn the npm way, but you can still use redux and react-redux by adding these to your HTML:

<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/4.0.1/redux.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/6.0.1/react-redux.min.js"></script>

(incidentally, I found these by googling “redux cdn” and “react-redux cdn”)

For the npm way, you’ll need to familiarize yourself with not just npm, but a module bundler such as Parcel or Webpack. For a first-timer, I’d recommend Parcel. Once you get the hang of npm and module bundlers, you’ll never want to go back to script tags.

1 Like

Ok thank God, it definitely seems as though everything I’m reading has to do with npm, definitely something I’ve never heard of before in my life. So I need to learn Parcel, then npm?

I’d say learn npm then parcel, but there’s very little about npm you’ll need to learn, mostly just npm install to manage dependencies, and maybe adding a script or two in the scripts section of package.json

1 Like

Ok thank you so much. Was beginning to feel like an insane person.

No worries, you do have to be a little bit insane to want to write code in the first place :crazy_face:

2 Likes

Sorry, one more thing: do I need to be using node.js in order to use these things? Because that’s also something I haven’t dug into yet.

I’ve just watched theNewBoston’s guide to react and redux and found it useful to help connect all the different parts (actions, reducers…) in my brain. Good luck with the project, I’ll be doing it soon!

1 Like

You do need to have npm, which comes as part of node.js. You won’t be running your project on node, but all the tools like Parcel are in javascript, so you need node to run those. If you’re on linux or a mac, I find the quickest way to install it is with nvm. On Windows, I’m not sure what the best way to go is, I haven’t used it in quite a while.

1 Like

Ok! Thanks for all of your help.

BTW, I heartily recommend Dan Abramov’s tutorial series which starts with just plain redux, then react-redux. He does it all on jsbin (so he’s also using script tags) but it’s not hard to transfer that knowledge to later use a module bundler in a standalone project. He’s also the author of Redux.

1 Like