Setting up complete React Redux SPA application

This article is the continuation of the previous article I published, https://medium.com/@waihein/setting-up-laravel-react-js-spa-application-decf269ed3b3. So I recommend going through the previous article before you continue because we will be installing Redux on the project from the previous article.

Install the required npm dependencies.

  • npm install react-redux redux redux-thunk redux-devtools-extension axios

Then create a store.js file under resources/js/superadmin/ folder with the following content.

Then update the app.js with the following content.

Then we need to create a folder to store actions. So we need to create a new action file called, resources/js/superadmin/actions/DashboardActions with the following content.

Later you can update the content based on your requirements.

Then we need to create a new file for reducer called, resources/js/superadmin/reducers/DashboardReducer.js. Following is the dummy content.

Then we create another file called, resources/js/superadmin/reducers/index.js with the following content.

We update the Dashboard.js component with the following content to make use of Redux.

That’s it. That is how we implement Redux.

Software Developer based in the UK, used to work in Singapore, but originally from Myanmar.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store