React-Redux is the official package that helps React applications connect with Redux state management. Redux Toolkit is a newer, more user-friendly package that simplifies Redux development by including useful tools and reducing boilerplate code. While React-Redux focuses on connecting React and Redux, Redux Toolkit provides a complete solution with built-in best practices and helper functions.
React-Redux provides a way to connect React components to a Redux store, while Redux Toolkit provides a set of tools to simplify Redux development, including a configureStore function, a createReducer function, and a createApi function.
Both packages support TypeScript, with react-redux having built-in TypeScript definitions and redux-toolkit providing a @types/redux-toolkit package.
Both packages are compatible with modern browsers, including Chrome, Firefox, and Edge.
React-Redux depends on React and Redux, while Redux Toolkit depends on Redux.
Both packages have good performance characteristics, with react-redux providing optimized re-renders and redux-toolkit providing optimized store updates.
Both packages are compatible with React, with react-redux being specifically designed for React and redux-toolkit being compatible with React and other frameworks.
Both packages have active communities, with react-redux having a larger community due to its longer history.
Both packages have high-quality documentation, with react-redux having a more comprehensive guide and redux-toolkit having a more concise API reference.
Both packages are actively maintained, with react-redux having a more frequent release cycle.
1import React from 'react';
2import { connect } from 'react-redux';
3
4const Counter = ({ count, increment }) => {
5 return (
6 <div>
7 <p>Count: {count}</p>
8 <button onClick={increment}>Increment</button>
9 </div>
10 );
11};
12
13const mapStateToProps = state => {
14 return { count: state.count };
15};
16
17const mapDispatchToProps = dispatch => {
18 return { increment: () => dispatch({ type: 'INCREMENT' }) };
19};
20
21export default connect(mapStateToProps, mapDispatchToProps)(Counter);
This example shows how to connect a React component to a Redux store using react-redux. We define a Counter component that displays the current count and has an increment button. We then use the connect function to connect the component to the Redux store, mapping the state to props and dispatching actions to the store.
1import { configureStore } from '@reduxjs/toolkit';
2import counterReducer from './counterReducer';
3
4const store = configureStore({
5 reducer: {
6 counter: counterReducer
7 }
8});
9
10export default store;
This example shows how to create a Redux store using Redux Toolkit. We import the configureStore function and our counterReducer, and then create a store with the reducer. We can then use the store in our React application.
Both packages are well-established and widely used, but Redux Toolkit provides a more modern and streamlined approach to Redux development.
A tiny state management solution that uses hooks. It's much simpler than Redux and requires way less code to get started. Perfect for small to medium React applications.
It's a great alternative because it's easier to learn than Redux, has zero dependencies, and doesn't need any wrapping Provider components. You can start using it in minutes without complex setup.
State ManagementFacebook's own state management library that works with atoms (small pieces of state) and selectors. It's built specifically for React and handles complex state requirements really well.
Created by Facebook (like React), it's great for large applications that need to manage lots of data. It's especially good at handling derived state and async data.
State ManagementA state management tool that breaks down your state into small atomic pieces. It's like Lego blocks for your app's data, where you can combine small pieces to build bigger things.
It's perfect for those who find Redux too complicated. It works great with React's concurrent features and has a very simple API that feels natural with React hooks.
State ManagementA battle-tested library that makes state management simple and scalable. It uses observable patterns to automatically track and update your app's state.
It's simpler than Redux but just as powerful. Changes to state are automatically reflected in your app without manual updates, which means less code to write and maintain.
State ManagementOfficial React bindings for Redux. Performant and flexible.
The recommended way to start new apps with React and Redux is by using our official Redux+TS template for Vite, or by creating a new Next.js project using Next's with-redux
template.
Both of these already have Redux Toolkit and React-Redux configured appropriately for that build tool, and come with a small example app that demonstrates how to use several of Redux Toolkit's features.
# Vite with our Redux+TS template # (using the `degit` tool to clone and extract the template) npx degit reduxjs/redux-templates/packages/vite-template-redux my-app # Next.js using the `with-redux` template npx create-next-app --example with-redux my-app
React Redux 8.0 requires React 16.8.3 or later (or React Native 0.59 or later).
To use React Redux with your React app, install it as a dependency:
# If you use npm: npm install react-redux # Or if you use Yarn: yarn add react-redux
You'll also need to install Redux and set up a Redux store in your app.
This assumes that you’re using npm package manager with a module bundler like Webpack or Browserify to consume CommonJS modules.
If you don’t yet use npm or a modern module bundler, and would rather prefer a single-file UMD build that makes ReactRedux
available as a global object, you can grab a pre-built version from cdnjs. We don’t recommend this approach for any serious application, as most of the libraries complementary to Redux are only available on npm.
The React Redux docs are published at https://react-redux.js.org .
The post The History and Implementation of React-Redux explains what it does, how it works, and how the API and implementation have evolved over time.
There's also a Deep Dive into React-Redux talk that covers some of the same material at a higher level.
Respectfully opinionated convention-driven framework for building React applications. Built on React, Webpack, Redux, and React Router.
Data portal API and component generation
Pola pomoże Ci odnaleźć polskie wyroby. Zabierając Polę na zakupy odnajdujesz produkty “z duszą” i wspierasz polską gospodarkę.
Code recipes for Amber Framework
Java Management Extension Client for Monitoring Kafka Metrics
Dispatch system for emergency volunteer couriers.
@reactjs template with redux-toolkit and typescript included, And needed libs and pkgs installed and included as well.
Created with CodeSandbox