react-redux README

The project's README from github.com/reduxjs/react-redux. As one markdown file: README.md.

React Redux

Official React bindings for Redux. Performant and flexible.

GitHub Workflow Status npm version npm downloads #redux channel on Discord

Installation

Create a React Redux App

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

An Existing React App

React Redux 9.0 requires React 18 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.

Documentation

The React Redux docs are published at https://react-redux.js.org .

How Does It Work?

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.

License

MIT

react-redux (reduxjs/react-redux)

Searching Database…

Что это такое?Официальные React-биндинги для Redux — библиотека, которая связывает ваши React-компоненты с Redux-стором, чтобы они могли читать состояние и отправлять действия (actions).
Это сам Redux или что-то дополнительное, что ставится поверх?Это библиотека, а не сам Redux. Вы устанавливаете её вместе с Redux, и она берёт на себя всю работу на стороне React — подписывает компоненты на ваш стор.
Как добавить её в уже существующее React-приложение?Выполните npm install react-redux, затем установите Redux и создайте стор в своём приложении. Подразумевается, что вы используете npm и сборщик модулей вроде Webpack или Browserify.
Будет ли оно работать с моей версией React?React Redux 9.0 требует React 18 или новее. Сам пакет очень маленький: единственная runtime-зависимость — use-sync-external-store, а TypeScript-типы уже идут в комплекте.
А можно просто подключить его с CDN через тег script?Готовая UMD-сборка есть на cdnjs — она доступна как глобальный объект ReactRedux. Но в README не советуют делать это для серьёзных приложений: большинство вспомогательных Redux-библиотек доступны только через npm.
Как правильно начать с ним совершенно новое приложение?Используйте официальный шаблон Redux+TS для Vite или создайте проект Next.js с шаблоном with-redux. В обоих случаях Redux Toolkit и React-Redux уже настроены под этот инструмент сборки, а вдобавок идёт небольшой пример приложения.
Где почитать о том, как оно устроено внутри?Пост 'History and Implementation of React-Redux' рассказывает, что делает библиотека и как со временем менялись её API и реализация. Есть также доклад Deep Dive, где то же самое объясняется на более общем уровне.
Проект до сих пор активно развивается?Да — он живёт в официальной организации reduxjs на GitHub, создан в 2015 году, у него больше 23 тысяч звёзд, он не переведён в архив, а в репозитории настроены CI-процесс на тесты, сборки и релизы.
Creator
reduxjs
Size
14.4 MB
Stars
23.4K
Age
11y
Commits · 90 Days