[solved] How to deploy a redux (no React) app to Github Pages? (no backend)


Really hard to find any information on Redux deployment on Github Pages (everything I found is about React-Redux). Pointers on how to deploy a redux (no React) app to Github Pages? (no backend).

Would also love pointers on how to structure the code (again, boilerplates I find are all about React-Redux).

Thanks in advance

Exactly the same way you would deploy anything to GH pages: HTML index page which has a script tag or tags that reference the JS you’re using.

But Redux is just a state container for your JS app, it doesn’t do anything visually on its own. There aren’t any guides because it isn’t something that is ever done, it doesn’t makes sense; it’s literally just a JS object with some functions attached to it: how would you display that on an HTML page?

Thanks for the quick response Dan!

So, in codepen I had the Redux library added via settings for the JS panel with https://cdnjs.cloudflare.com/ajax/libs/redux/4.0.4/redux.min.js added.

Do I just link up that library to my index.html like I would other scripts?

And then how do I make the Redux functions available inside my index.js? Do I use import? I do not have any package.json.

Yup, that will work. No import, you should now have Redux available as a global variable, so you can do like const myStore = Redux.createStore(...yadda yadda

Thanks Dan!

For others in the future: Should you follow this path to install Redux in your project (but use the UMD build as per Redux’s installation instructions), the global variable is window.Redux, so:

const Redux = window.Redux;

allows you to:

const myStore = Redux.createStore(...yadda yadda

For more on it: https://redux.js.org/introduction/installation

1 Like