Skip to content

Commit e4470bf

Browse files
authored
Merge pull request #4537 from reduxjs/docs/modernize-installation-steps
2 parents eb36f19 + d36e7f4 commit e4470bf

File tree

3 files changed

+54
-29
lines changed

3 files changed

+54
-29
lines changed

docs/introduction/GettingStarted.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You can use Redux together with [React](https://reactjs.org), or with any other
1717

1818
### Redux Toolkit
1919

20-
[**Redux Toolkit**](https://redux-toolkit.js.org) is our official recommended approach for writing Redux logic. It wraps around the Redux core, and contains packages and functions that we think are essential for building a Redux app. Redux Toolkit builds in our suggested best practices, simplifies most Redux tasks, prevents common mistakes, and makes it easier to write Redux applications.
20+
[**Redux Toolkit**](https://redux-toolkit.js.org) is our official standard approach for writing Redux logic. It wraps around the Redux core, and contains packages and functions that we think are essential for building a Redux app. Redux Toolkit builds in our suggested best practices, simplifies most Redux tasks, prevents common mistakes, and makes it easier to write Redux applications.
2121

2222
RTK includes utilities that help simplify many common use cases, including [store setup](https://redux-toolkit.js.org/api/configureStore),
2323
[creating reducers and writing immutable update logic](https://redux-toolkit.js.org/api/createreducer),
@@ -39,16 +39,24 @@ yarn add @reduxjs/toolkit
3939

4040
### Create a React Redux App
4141

42-
The recommended way to start new apps with React and Redux is by using the [official Redux+JS template](https://github.com/reduxjs/cra-template-redux) or [Redux+TS template](https://github.com/reduxjs/cra-template-redux-typescript) for [Create React App](https://github.com/facebook/create-react-app), which takes advantage of **[Redux Toolkit](https://redux-toolkit.js.org/)** and React Redux's integration with React components.
42+
The recommended way to start new apps with React and Redux is by using [our official Redux+TS template for Vite](https://github.com/reduxjs/redux-templates), or by creating a new Next.js project using [Next's `with-redux` template](https://github.com/vercel/next.js/tree/canary/examples/with-redux).
43+
44+
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.
4345

4446
```bash
45-
# Redux + Plain JS template
46-
npx create-react-app my-app --template redux
47+
# Vite with our Redux+TS template
48+
# (using the `degit` tool to clone and extract the template)
49+
npx degit reduxjs/redux-templates/packages/vite-template-redux my-app
4750

48-
# Redux + TypeScript template
49-
npx create-react-app my-app --template redux-typescript
51+
# Next.js using the `with-redux` template
52+
npx create-next-app --example with-redux my-app
5053
```
5154

55+
We do not currently have official React Native templates, but recommend these templates for standard React Native and for Expo:
56+
57+
- https://github.com/rahsheen/react-native-template-redux-typescript
58+
- https://github.com/rahsheen/expo-template-redux-typescript
59+
5260
### Redux Core
5361

5462
The Redux core library is available as a package on NPM for use with a module bundler or in a Node application:

docs/introduction/Installation.md

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,62 @@ yarn add @reduxjs/toolkit
2222

2323
It's also available as a UMD build, which can be loaded from [the `dist` folder on unpkg](https://unpkg.com/@reduxjs/toolkit/dist/). The UMD builds make Redux Toolkit available as a `window.RTK` global variable.
2424

25-
## Redux Core
25+
## Complementary Packages
2626

27-
To install the stable version:
27+
### React-Redux
2828

29-
```bash
30-
# NPM
31-
npm install redux
29+
Most likely, you'll also need [the `react-redux` bindings for use with React](https://github.com/reduxjs/react-redux)
3230

33-
# Yarn
34-
yarn add redux
31+
```bash
32+
npm install react-redux
3533
```
3634

37-
If you're not, you can [access these files on unpkg](https://unpkg.com/redux/), download them, or point your package manager to them.
35+
Note that unlike Redux itself, many packages in the Redux ecosystem don't provide UMD builds, so we recommend using module bundlers like [Vite](https://vitejs.dev/) and [Webpack](https://webpack.js.org/) for the most comfortable development experience.
3836

39-
Most commonly, people consume Redux as a collection of [CommonJS](http://www.commonjs.org/) modules. These modules are what you get when you import `redux` in a [Webpack](https://webpack.js.org/), [Browserify](http://browserify.org/), or a Node environment. If you like to live on the edge and use [Rollup](https://rollupjs.org), we support that as well.
37+
### Redux DevTools Extension
4038

41-
If you don't use a module bundler, it's also fine. The `redux` npm package includes precompiled production and development [UMD](https://github.com/umdjs/umd) builds in the [`dist` folder](https://unpkg.com/redux/dist/). They can be used directly without a bundler and are thus compatible with many popular JavaScript module loaders and environments. For example, you can drop a UMD build as a [`<script>` tag](https://unpkg.com/redux/dist/redux.js) on the page, or [tell Bower to install it](https://github.com/reduxjs/redux/pull/1181#issuecomment-167361975). The UMD builds make Redux available as a `window.Redux` global variable.
39+
Redux Toolkit's `configureStore` automatically sets up integration with the pRedux DevTools](https://github.com/reduxjs/redux-devtools/tree/main/extension). You'll want to install the browser extensions to view the store state and actions:
4240

43-
The Redux source code is written in ES2015 but we precompile both CommonJS and UMD builds to ES5 so they work in [any modern browser](https://caniuse.com/#feat=es5). You don't need to use Babel or a module bundler to [get started with Redux](https://redux.js.org/introduction/examples#counter-vanilla).
41+
- Redux DevTools Extension:
42+
- [Redux DevTools Extension for Chrome](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en)
43+
- [Redux DevTools Extension for Firefox](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/)
4444

45-
## Complementary Packages
45+
If you're using React, you'll want the React DevTools extension as well:
46+
47+
- React DevTools Extension:
48+
- [React DevTools Extension for Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)
49+
- [React DevTools Extension for Firefox](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/)
50+
51+
## Create a React Redux App
52+
53+
The recommended way to start new apps with React and Redux is by using [our official Redux+TS template for Vite](https://github.com/reduxjs/redux-templates), or by creating a new Next.js project using [Next's `with-redux` template](https://github.com/vercel/next.js/tree/canary/examples/with-redux).
4654

47-
Most likely, you'll also need [the React bindings](https://github.com/reduxjs/react-redux) and [the developer tools](https://github.com/reduxjs/redux-devtools).
55+
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.
4856

4957
```bash
50-
npm install react-redux
51-
npm install --save-dev @redux-devtools/core
58+
# Vite with our Redux+TS template
59+
# (using the `degit` tool to clone and extract the template)
60+
npx degit reduxjs/redux-templates/packages/vite-template-redux my-app
61+
62+
# Next.js using the `with-redux` template
63+
npx create-next-app --example with-redux my-app
5264
```
5365

54-
Note that unlike Redux itself, many packages in the Redux ecosystem don't provide UMD builds, so we recommend using CommonJS module bundlers like [Webpack](https://webpack.js.org/) and [Browserify](http://browserify.org/) for the most comfortable development experience.
66+
We do not currently have official React Native templates, but recommend these templates for standard React Native and for Expo:
5567

56-
## Create a React Redux App
68+
- https://github.com/rahsheen/react-native-template-redux-typescript
69+
- https://github.com/rahsheen/expo-template-redux-typescript
70+
71+
## Redux Core
5772

58-
The recommended way to start new apps with React and Redux is by using the [official Redux+JS template](https://github.com/reduxjs/cra-template-redux) or [Redux+TS template](https://github.com/reduxjs/cra-template-redux-typescript) for [Create React App](https://github.com/facebook/create-react-app), which takes advantage of **[Redux Toolkit](https://redux-toolkit.js.org/)** and React Redux's integration with React components.
73+
To install the `redux` core package by itself:
5974

6075
```bash
61-
# Redux + Plain JS template
62-
npx create-react-app my-app --template redux
76+
# NPM
77+
npm install redux
6378

64-
# Redux + TypeScript template
65-
npx create-react-app my-app --template redux-typescript
79+
# Yarn
80+
yarn add redux
6681
```
82+
83+
If you're not using a bundler, you can [access these files on unpkg](https://unpkg.com/redux/), download them, or point your package manager to them.

docs/tutorials/essentials/part-3-data-flow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ If you'd like to see the final version of what we're going to build, you can che
5555
5656
#### Creating a New Redux + React Project
5757

58-
Once you've finished this tutorial, you'll probably want to try working on your own projects. **We recommend using the [Redux templates for Create-React-App](https://github.com/reduxjs/cra-template-redux) as the fastest way to create a new Redux + React project**. It comes with Redux Toolkit and React-Redux already configured, using [the same "counter" app example you saw in Part 1](./part-1-overview-concepts.md). This lets you jump right into writing your actual application code without having to add the Redux packages and set up the store.
58+
Once you've finished this tutorial, you'll probably want to try working on your own projects. **We recommend using the [Redux template for Vite](../../introduction/Installation.md#create-a-react-redux-app) as the fastest way to create a new Redux + React project**. It comes with Redux Toolkit and React-Redux already configured, using [the same "counter" app example you saw in Part 1](./part-1-overview-concepts.md). This lets you jump right into writing your actual application code without having to add the Redux packages and set up the store.
5959

6060
If you want to know specific details on how to add Redux to a project, see this explanation:
6161

0 commit comments

Comments
 (0)