The lifesaver for any Redux developer
If you’re a frontend developer, you’ve probably dealt with the massive amount of bloat and boilerplate that can come with Redux. Setting up actions and reducers can lead to hundreds of line of code that relatively simple, but necessary.
Due to these problems, I switched over to using Recoil for a while, but then I remembered about Redux Toolkit.
Redux Toolkit is:
The official, opinionated, batteries-included toolset for efficient Redux development
With a variety of utilities and a slightly opionated framework, it reduces the amount of fluff code you have to write to implement Redux.
Even better, it’s officially supported by the Redux team, which means it works just as well as Redux with half the code.
With Redux Toolkit, there’s a standardized method for creating Redux logic that’s simple and easy to use.
We’ll be writing an example application with Redux toolkit to see how it works in action. You can see the finished code here.
Lets first setup a basic React app:
npx create-react-app my-app
Next, lets install redux and redux-toolkit:
cd my-app yarn add redux @reduxjs/toolkit
Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.
Redux is a light weighted State Management Tool that helps the components in our React App to communicate with each other. The simple concept behind this is that every state of the component is kept in a store that will be global. So that every component can access any state from that store.
In this video I wanted to show the basics of Redux in React, I didn't go over anything complex as I wanted this to be a beginners introduction into Redux. Let me know in the comments if you would like to see more content on redux such as Redux Thunk.
React Native Redux Example Tutorial From Scratch. We connect the React Native app to Redux store to save and retrieve the application data.
How to set up a basic version of Redux in your React or React Native application. To make things clearer, I based my setup on my event application, where users create events that other users attend. We generated the action creators, reducers, and Redux store, and wrapped the application in a provider.