rsnext/examples/with-redux-toolkit
Nick Babcock 5629223407
Update examples to use React 17 (#26133)
[With next 11 requiring react 17](https://nextjs.org/blog/next-11#upgrade-guide), most of the examples
need to be updated, so the following snippet updated all the examples to
a compatible react version.

```bash
cd examples/
fd -g 'package.json' | xargs sed -r -i 's/"react": ".*"/"react": "^17.0.2"/
fd -g 'package.json' | xargs sed -r -i 's/"react-dom": ".*"/"react-dom": "^17.0.2"/'

# exclude experimental react version
git checkout with-reason-relay/package.json
```
2021-06-16 16:43:26 +00:00
..
public Simplify redux toolkit example and update packages (#23047) 2021-03-16 20:15:54 +00:00
src Simplify redux toolkit example and update packages (#23047) 2021-03-16 20:15:54 +00:00
.gitignore Added .gitignore to examples that are deployed to vercel (#15127) 2020-07-16 10:52:23 -04:00
package.json Update examples to use React 17 (#26133) 2021-06-16 16:43:26 +00:00
README.md Fix broken link (#23230) 2021-03-19 20:58:22 +00:00

Redux Toolkit example

This example shows how to integrate Next.js with Redux Toolkit.

The Redux Toolkit is intended to be the standard way to write Redux logic (create actions and reducers, setup the store with some default middlewares like redux devtools extension). This example demonstrates each of these features with Next.js

Deploy your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example with-redux-toolkit with-redux-toolkit-app
# or
yarn create next-app --example with-redux-toolkit with-redux-toolkit-app

Deploy it to the cloud with Vercel (Documentation).

TypeScript Setup (optional)

If you haven't already added TypeScript to your project, follow the steps in the Next.js documentation. If you are new to TypeScript, go through the Next.js learning lesson on TypeScript.

Once TypeScript is added, follow the instructions given on the Redux Toolkit documentation to set up and use Redux Toolkit and React-Redux with TypeScript