+ You can find past versions of this project on{' '}
+ GitHub.
+
+
+
+
+ );
+ }
+
+ module.exports = Versions;
\ No newline at end of file
diff --git a/website/siteConfig.js b/website/siteConfig.js
index ce8253de4..5e134978f 100644
--- a/website/siteConfig.js
+++ b/website/siteConfig.js
@@ -98,6 +98,15 @@ const siteConfig = {
// template. For example, if you need your repo's URL...
repoUrl: "https://github.com/reduxjs/react-redux",
+ /**
+ * Note:
+ * This will generate a link on the versioned docs page for "pre-release versions"
+ * Once next version is released, run "yarn run version 7.x", and docusaurus will add 7.x to stable version
+ * After that, 7.x will no longer appear in "pre-release" versions and we should remove this line
+ * More info: https://docusaurus.io/docs/en/versioning
+ */
+ nextVersion: "7.x",
+
gaTrackingId : "UA-130598673-2",
};
diff --git a/website/versioned_docs/version-5.x/api.md b/website/versioned_docs/version-5.x/api.md
new file mode 100644
index 000000000..9f5088d4d
--- /dev/null
+++ b/website/versioned_docs/version-5.x/api.md
@@ -0,0 +1,492 @@
+---
+id: version-5.x-api
+title: Api
+sidebar_label: API
+hide_title: true
+original_id: api
+---
+
+# API
+
+
+## Provider
+
+Makes the Redux store available to the `connect()` calls in the component hierarchy below. Normally, you can’t use `connect()` without wrapping a parent or ancestor component in ``.
+
+If you *really* need to, you can manually pass `store` as a prop to every `connect()`ed component, but we only recommend to do this for stubbing `store` in unit tests, or in non-fully-React codebases. Normally, you should just use ``.
+
+### Props
+
+* `store` (*[Redux Store](https://redux.js.org/api-reference/store)*): The single Redux store in your application.
+* `children` (*ReactElement*) The root of your component hierarchy.
+
+### Example
+
+#### Vanilla React
+
+```jsx
+ReactDOM.render(
+
+
+ ,
+ rootEl
+)
+```
+
+#### React Router
+
+```jsx
+ReactDOM.render(
+
+
+
+
+
+
+
+ ,
+ document.getElementById('root')
+)
+```
+
+
+## connect
+
+```
+connect([mapStateToProps], [mapDispatchToProps], [mergeProps], [options])
+```
+
+Connects a React component to a Redux store. `connect` is a facade around `connectAdvanced`, providing a convenient API for the most common use cases.
+
+It does not modify the component class passed to it; instead, it *returns* a new, connected component class for you to use.
+
+### Arguments
+
+* [`mapStateToProps(state, [ownProps]): stateProps`] \(*Function*): If this argument is specified, the new component will subscribe to Redux store updates. This means that any time the store is updated, `mapStateToProps` will be called. The results of `mapStateToProps` must be a plain object, which will be merged into the component’s props. If you don't want to subscribe to store updates, pass `null` or `undefined` in place of `mapStateToProps`.
+
+ If your `mapStateToProps` function is declared as taking two parameters, it will be called with the store state as the first parameter and the props passed to the connected component as the second parameter, and will also be re-invoked whenever the connected component receives new props as determined by shallow equality comparisons. (The second parameter is normally referred to as `ownProps` by convention.)
+
+ >Note: in advanced scenarios where you need more control over the rendering performance, `mapStateToProps()` can also return a function. In this case, *that* function will be used as `mapStateToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reduxjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
+
+ >The `mapStateToProps` function's first argument is the entire Redux store’s state and it returns an object to be passed as props. It is often called a **selector**. Use [reselect](https://github.com/reduxjs/reselect) to efficiently compose selectors and [compute derived data](https://redux.js.org/recipes/computing-derived-data).
+
+* [`mapDispatchToProps(dispatch, [ownProps]): dispatchProps`] \(*Object* or *Function*): If an object is passed, each function inside it is assumed to be a Redux action creator. An object with the same function names, but with every action creator wrapped into a `dispatch` call so they may be invoked directly, will be merged into the component’s props.
+
+ If a function is passed, it will be given `dispatch` as the first parameter. It’s up to you to return an object that somehow uses `dispatch` to bind action creators in your own way. (Tip: you may use the [`bindActionCreators()`](https://redux.js.org/api-reference/bindactioncreators) helper from Redux.)
+
+ If your `mapDispatchToProps` function is declared as taking two parameters, it will be called with `dispatch` as the first parameter and the props passed to the connected component as the second parameter, and will be re-invoked whenever the connected component receives new props. (The second parameter is normally referred to as `ownProps` by convention.)
+
+ If you do not supply your own `mapDispatchToProps` function or object full of action creators, the default `mapDispatchToProps` implementation just injects `dispatch` into your component’s props.
+
+ >Note: in advanced scenarios where you need more control over the rendering performance, `mapDispatchToProps()` can also return a function. In this case, *that* function will be used as `mapDispatchToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reduxjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
+
+* [`mergeProps(stateProps, dispatchProps, ownProps): props`] \(*Function*): If specified, it is passed the result of `mapStateToProps()`, `mapDispatchToProps()`, and the parent `props`. The plain object you return from it will be passed as props to the wrapped component. You may specify this function to select a slice of the state based on props, or to bind action creators to a particular variable from props. If you omit it, `Object.assign({}, ownProps, stateProps, dispatchProps)` is used by default.
+
+* [`options`] *(Object)* If specified, further customizes the behavior of the connector. In addition to the options passable to `connectAdvanced()` (see those below), `connect()` accepts these additional options:
+ * [`pure`] *(Boolean)*: If true, `connect()` will avoid re-renders and calls to `mapStateToProps`, `mapDispatchToProps`, and `mergeProps` if the relevant state/props objects remain equal based on their respective equality checks. Assumes that the wrapped component is a “pure” component and does not rely on any input or state other than its props and the selected Redux store’s state. Default value: `true`
+ * [`areStatesEqual`] *(Function)*: When pure, compares incoming store state to its previous value. Default value: `strictEqual (===)`
+ * [`areOwnPropsEqual`] *(Function)*: When pure, compares incoming props to its previous value. Default value: `shallowEqual`
+ * [`areStatePropsEqual`] *(Function)*: When pure, compares the result of `mapStateToProps` to its previous value. Default value: `shallowEqual`
+ * [`areMergedPropsEqual`] *(Function)*: When pure, compares the result of `mergeProps` to its previous value. Default value: `shallowEqual`
+ * [`storeKey`] *(String)*: The key of the context from where to read the store. You probably only need this if you are in the inadvisable position of having multiple stores. Default value: `'store'`
+
+#### The arity of mapStateToProps and mapDispatchToProps determines whether they receive ownProps
+
+> Note: `ownProps` **is not passed** to `mapStateToProps` and `mapDispatchToProps` if the formal definition of the function contains one mandatory parameter (function has length 1). For example, functions defined like below won't receive `ownProps` as the second argument.
+
+```js
+function mapStateToProps(state) {
+ console.log(state); // state
+ console.log(arguments[1]); // undefined
+}
+```
+```js
+const mapStateToProps = (state, ownProps = {}) => {
+ console.log(state); // state
+ console.log(ownProps); // {}
+}
+```
+
+Functions with no mandatory parameters or two parameters **will receive** `ownProps`.
+```js
+const mapStateToProps = (state, ownProps) => {
+ console.log(state); // state
+ console.log(ownProps); // ownProps
+}
+```
+```js
+function mapStateToProps() {
+ console.log(arguments[0]); // state
+ console.log(arguments[1]); // ownProps
+}
+```
+```js
+const mapStateToProps = (...args) => {
+ console.log(args[0]); // state
+ console.log(args[1]); // ownProps
+}
+```
+
+#### Optimizing connect when options.pure is true
+
+When `options.pure` is true, `connect` performs several equality checks that are used to avoid unnecessary calls to `mapStateToProps`, `mapDispatchToProps`, `mergeProps`, and ultimately to `render`. These include `areStatesEqual`, `areOwnPropsEqual`, `areStatePropsEqual`, and `areMergedPropsEqual`. While the defaults are probably appropriate 99% of the time, you may wish to override them with custom implementations for performance or other reasons. Here are several examples:
+
+* You may wish to override `areStatesEqual` if your `mapStateToProps` function is computationally expensive and is also only concerned with a small slice of your state. For example: `areStatesEqual: (next, prev) => prev.entities.todos === next.entities.todos`; this would effectively ignore state changes for everything but that slice of state.
+
+* You may wish to override `areStatesEqual` to always return false (`areStatesEqual: () => false`) if you have impure reducers that mutate your store state. (This would likely impact the other equality checks as well, depending on your `mapStateToProps` function.)
+
+* You may wish to override `areOwnPropsEqual` as a way to whitelist incoming props. You'd also have to implement `mapStateToProps`, `mapDispatchToProps` and `mergeProps` to also whitelist props. (It may be simpler to achieve this other ways, for example by using [recompose's mapProps](https://github.com/acdlite/recompose/blob/master/docs/API.md#mapprops).)
+
+* You may wish to override `areStatePropsEqual` to use `strictEqual` if your `mapStateToProps` uses a memoized selector that will only return a new object if a relevant prop has changed. This would be a very slight performance improvement, since would avoid extra equality checks on individual props each time `mapStateToProps` is called.
+
+* You may wish to override `areMergedPropsEqual` to implement a `deepEqual` if your selectors produce complex props. ex: nested objects, new arrays, etc. (The deep equal check should be faster than just re-rendering.)
+
+### Returns
+
+A higher-order React component class that passes state and action creators into your component derived from the supplied arguments. This is created by `connectAdvanced`, and details of this higher-order component are covered there.
+
+
+#### Examples
+
+#### Inject just `dispatch` and don't listen to store
+
+```js
+export default connect()(TodoApp)
+```
+
+#### Inject all action creators (`addTodo`, `completeTodo`, ...) without subscribing to the store
+
+```js
+import * as actionCreators from './actionCreators'
+
+export default connect(null, actionCreators)(TodoApp)
+```
+
+#### Inject `dispatch` and every field in the global state
+
+>Don’t do this! It kills any performance optimizations because `TodoApp` will rerender after every state change.
+>It’s better to have more granular `connect()` on several components in your view hierarchy that each only
+>listen to a relevant slice of the state.
+
+```js
+export default connect(state => state)(TodoApp)
+```
+
+#### Inject `dispatch` and `todos`
+
+```js
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+export default connect(mapStateToProps)(TodoApp)
+```
+
+#### Inject `todos` and all action creators
+
+```js
+import * as actionCreators from './actionCreators'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+export default connect(mapStateToProps, actionCreators)(TodoApp)
+```
+
+#### Inject `todos` and all action creators (`addTodo`, `completeTodo`, ...) as `actions`
+
+```js
+import * as actionCreators from './actionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return { actions: bindActionCreators(actionCreators, dispatch) }
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos` and a specific action creator (`addTodo`)
+
+```js
+import { addTodo } from './actionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return bindActionCreators({ addTodo }, dispatch)
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos` and specific action creators (`addTodo` and `deleteTodo`) with shorthand syntax
+
+```js
+import { addTodo, deleteTodo } from './actionCreators'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+const mapDispatchToProps = {
+ addTodo,
+ deleteTodo
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos`, todoActionCreators as `todoActions`, and counterActionCreators as `counterActions`
+
+```js
+import * as todoActionCreators from './todoActionCreators'
+import * as counterActionCreators from './counterActionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return {
+ todoActions: bindActionCreators(todoActionCreators, dispatch),
+ counterActions: bindActionCreators(counterActionCreators, dispatch)
+ }
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos`, and todoActionCreators and counterActionCreators together as `actions`
+
+```js
+import * as todoActionCreators from './todoActionCreators'
+import * as counterActionCreators from './counterActionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return {
+ actions: bindActionCreators(Object.assign({}, todoActionCreators, counterActionCreators), dispatch)
+ }
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos`, and all todoActionCreators and counterActionCreators directly as props
+
+```js
+import * as todoActionCreators from './todoActionCreators'
+import * as counterActionCreators from './counterActionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return bindActionCreators(Object.assign({}, todoActionCreators, counterActionCreators), dispatch)
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos` of a specific user depending on props
+
+```js
+import * as actionCreators from './actionCreators'
+
+function mapStateToProps(state, ownProps) {
+ return { todos: state.todos[ownProps.userId] }
+}
+
+export default connect(mapStateToProps)(TodoApp)
+```
+
+#### Inject `todos` of a specific user depending on props, and inject `props.userId` into the action
+
+```js
+import * as actionCreators from './actionCreators'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mergeProps(stateProps, dispatchProps, ownProps) {
+ return Object.assign({}, ownProps, {
+ todos: stateProps.todos[ownProps.userId],
+ addTodo: (text) => dispatchProps.addTodo(ownProps.userId, text)
+ })
+}
+
+export default connect(mapStateToProps, actionCreators, mergeProps)(TodoApp)
+```
+
+#### Factory functions
+
+Factory functions can be used for performance optimizations
+
+```js
+import { addTodo } from './actionCreators'
+
+function mapStateToPropsFactory(initialState, initialProps) {
+ const getSomeProperty= createSelector(...);
+ const anotherProperty = 200 + initialState[initialProps.another];
+ return function(state){
+ return {
+ anotherProperty,
+ someProperty: getSomeProperty(state),
+ todos: state.todos
+ }
+ }
+}
+
+function mapDispatchToPropsFactory(initialState, initialProps) {
+ function goToSomeLink(){
+ initialProps.history.push('some/link');
+ }
+ return function(dispatch){
+ return {
+ addTodo
+ }
+ }
+}
+
+
+export default connect(mapStateToPropsFactory, mapDispatchToPropsFactory)(TodoApp)
+```
+
+## connectAdvanced
+
+```js
+connectAdvanced(selectorFactory, [connectOptions])
+```
+
+Connects a React component to a Redux store. It is the base for `connect()` but is less opinionated about how to combine `state`, `props`, and `dispatch` into your final props. It makes no assumptions about defaults or memoization of results, leaving those responsibilities to the caller.
+
+It does not modify the component class passed to it; instead, it *returns* a new, connected component class for you to use.
+
+### Arguments
+
+* `selectorFactory(dispatch, factoryOptions): selector(state, ownProps): props` \(*Function*): Initializes a selector function (during each instance's constructor). That selector function is called any time the connector component needs to compute new props, as a result of a store state change or receiving new props. The result of `selector` is expected to be a plain object, which is passed as the props to the wrapped component. If a consecutive call to `selector` returns the same object (`===`) as its previous call, the component will not be re-rendered. It's the responsibility of `selector` to return that previous object when appropriate.
+
+* [`connectOptions`] *(Object)* If specified, further customizes the behavior of the connector.
+
+ * [`getDisplayName`] *(Function)*: computes the connector component's displayName property relative to that of the wrapped component. Usually overridden by wrapper functions. Default value: `name => 'ConnectAdvanced('+name+')'`
+
+ * [`methodName`] *(String)*: shown in error messages. Usually overridden by wrapper functions. Default value: `'connectAdvanced'`
+
+ * [`renderCountProp`] *(String)*: if defined, a property named this value will be added to the props passed to the wrapped component. Its value will be the number of times the component has been rendered, which can be useful for tracking down unnecessary re-renders. Default value: `undefined`
+
+ * [`shouldHandleStateChanges`] *(Boolean)*: controls whether the connector component subscribes to redux store state changes. If set to false, it will only re-render when parent component re-renders. Default value: `true`
+
+ * [`storeKey`] *(String)*: the key of props/context to get the store. You probably only need this if you are in the inadvisable position of having multiple stores. Default value: `'store'`
+
+ * [`withRef`] *(Boolean)*: If true, stores a ref to the wrapped component instance and makes it available via `getWrappedInstance()` method. Default value: `false`
+
+ * Additionally, any extra options passed via `connectOptions` will be passed through to your `selectorFactory` in the `factoryOptions` argument.
+
+
+
+### Returns
+
+A higher-order React component class that builds props from the store state and passes them to the wrapped component. A higher-order component is a function which accepts a component argument and returns a new component.
+
+#### Static Properties
+
+* `WrappedComponent` *(Component)*: The original component class passed to `connectAdvanced(...)(Component)`.
+
+#### Static Methods
+
+All the original static methods of the component are hoisted.
+
+#### Instance Methods
+
+##### `getWrappedInstance(): ReactComponent`
+
+Returns the wrapped component instance. Only available if you pass `{ withRef: true }` as part of the `options` argument.
+
+### Remarks
+
+* Since `connectAdvanced` returns a higher-order component, it needs to be invoked two times. The first time with its arguments as described above, and a second time, with the component: `connectAdvanced(selectorFactory)(MyComponent)`.
+
+* `connectAdvanced` does not modify the passed React component. It returns a new, connected component, that you should use instead.
+
+
+#### Examples
+
+#### Inject `todos` of a specific user depending on props, and inject `props.userId` into the action
+
+```js
+import * as actionCreators from './actionCreators'
+import { bindActionCreators } from 'redux'
+
+function selectorFactory(dispatch) {
+ let ownProps = {}
+ let result = {}
+ const actions = bindActionCreators(actionCreators, dispatch)
+ const addTodo = (text) => actions.addTodo(ownProps.userId, text)
+ return (nextState, nextOwnProps) => {
+ const todos = nextState.todos[nextOwnProps.userId]
+ const nextResult = { ...nextOwnProps, todos, addTodo }
+ ownProps = nextOwnProps
+ if (!shallowEqual(result, nextResult)) result = nextResult
+ return result
+ }
+}
+export default connectAdvanced(selectorFactory)(TodoApp)
+```
+
+## createProvider
+
+```js
+createProvider([storeKey])
+```
+
+Creates a new `` which will set the Redux Store on the passed key of the context. You probably only need this if you are in the inadvisable position of having multiple stores. You will also need to pass the same `storeKey` to the `options` argument of [`connect`](#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options)
+
+### Arguments
+
+* [`storeKey`] (*String*): The key of the context on which to set the store. Default value: `'store'`
+
+### Examples
+Before creating multiple stores, please go through this FAQ: [Can or should I create multiple stores?](http://redux.js.org/docs/faq/StoreSetup.html#can-or-should-i-create-multiple-stores-can-i-import-my-store-directly-and-use-it-in-components-myself)
+
+```js
+import {connect, createProvider} from 'react-redux'
+
+const STORE_KEY = 'componentStore'
+
+export const Provider = createProvider(STORE_KEY)
+
+function connectExtended(
+ mapStateToProps,
+ mapDispatchToProps,
+ mergeProps,
+ options = {}
+) {
+ options.storeKey = STORE_KEY
+ return connect(
+ mapStateToProps,
+ mapDispatchToProps,
+ mergeProps,
+ options
+ )
+}
+
+export {connectExtended as connect}
+```
+Now you can import the above `Provider` and `connect` and use them.
diff --git a/website/versioned_docs/version-5.x/api/Provider.md b/website/versioned_docs/version-5.x/api/Provider.md
new file mode 100644
index 000000000..2f0852feb
--- /dev/null
+++ b/website/versioned_docs/version-5.x/api/Provider.md
@@ -0,0 +1,121 @@
+---
+id: version-5.x-provider
+title: Provider
+sidebar_label: Provider
+original_id: provider
+---
+
+# ``
+
+## Overview
+
+The `` makes the Redux `store` available to any nested components that have been wrapped in the `connect()` function.
+
+Since any React component in a React-Redux app can be connected, most applications will render a `` at the top level, with the entire app’s component tree inside of it.
+
+Normally, you can’t use a connected component unless it is nested inside of a `` .
+
+Note: If you really need to, you can manually pass `store` as a prop to a connected component, but we only recommend to do this for stubbing `store` in unit tests, or in non-fully-React codebases. Normally, you should just use ``.
+
+### Props
+
+`store` (Redux Store)
+The single Redux `store` in your application.
+
+`children` (ReactElement)
+The root of your component hierarchy.
+
+
+### Example Usage
+
+In the example below, the `` component is our root-level component. This means it’s at the very top of our component hierarchy.
+
+**Vanilla React Example**
+
+```jsx
+ import React from 'react';
+ import ReactDOM from 'react-dom';
+ import { Provider } from 'react-redux';
+
+ import { App } from './App';
+ import createStore from './createReduxStore';
+
+ const store = createStore();
+
+ ReactDOM.render(
+
+
+ ,
+ document.getElementById('root')
+ )
+```
+
+
+**Usage with React Router**
+
+```jsx
+ import React from 'react';
+ import ReactDOM from 'react-dom';
+ import { Provider } from 'react-redux';
+ import { Router, Route } from 'react-router-dom';
+
+ import { App } from './App';
+ import { Foo } from './Foo';
+ import { Bar } from './Bar';
+ import createStore from './createReduxStore';
+
+ const store = createStore();
+
+ ReactDOM.render(
+
+
+
+
+
+
+
+ ,
+ document.getElementById('root')
+ )
+```
+
+## createProvider
+
+```js
+createProvider([storeKey])
+```
+
+Creates a new `` which will set the Redux Store on the passed key of the context. You probably only need this if you are in the inadvisable position of having multiple stores. You will also need to pass the same `storeKey` to the `options` argument of [`connect`](#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options)
+
+### Arguments
+
+* [`storeKey`] (*String*): The key of the context on which to set the store. Default value: `'store'`
+
+### Examples
+Before creating multiple stores, please go through this FAQ: [Can or should I create multiple stores?](http://redux.js.org/docs/faq/StoreSetup.html#can-or-should-i-create-multiple-stores-can-i-import-my-store-directly-and-use-it-in-components-myself)
+
+```js
+import {connect, createProvider} from 'react-redux'
+
+const STORE_KEY = 'componentStore'
+
+export const Provider = createProvider(STORE_KEY)
+
+function connectExtended(
+ mapStateToProps,
+ mapDispatchToProps,
+ mergeProps,
+ options = {}
+) {
+ options.storeKey = STORE_KEY
+ return connect(
+ mapStateToProps,
+ mapDispatchToProps,
+ mergeProps,
+ options
+ )
+}
+
+export {connectExtended as connect}
+```
+Now you can import the above `Provider` and `connect` and use them.
diff --git a/website/versioned_docs/version-5.x/api/api.md b/website/versioned_docs/version-5.x/api/api.md
new file mode 100644
index 000000000..cd25a8375
--- /dev/null
+++ b/website/versioned_docs/version-5.x/api/api.md
@@ -0,0 +1,51 @@
+---
+id: version-5.x-api
+title: Api
+sidebar_label: API
+hide_title: true
+original_id: api
+---
+
+# API
+
+
+## Provider
+
+Makes the Redux store available to the `connect()` calls in the component hierarchy below. Normally, you can’t use `connect()` without wrapping a parent or ancestor component in ``.
+
+If you *really* need to, you can manually pass `store` as a prop to every `connect()`ed component, but we only recommend to do this for stubbing `store` in unit tests, or in non-fully-React codebases. Normally, you should just use ``.
+
+### Props
+
+* `store` (*[Redux Store](https://redux.js.org/api-reference/store)*): The single Redux store in your application.
+* `children` (*ReactElement*) The root of your component hierarchy.
+
+### Example
+
+#### Vanilla React
+
+```jsx
+ReactDOM.render(
+
+
+ ,
+ rootEl
+)
+```
+
+#### React Router
+
+```jsx
+ReactDOM.render(
+
+
+
+
+
+
+
+ ,
+ document.getElementById('root')
+)
+```
+
diff --git a/website/versioned_docs/version-5.x/api/connect-advanced.md b/website/versioned_docs/version-5.x/api/connect-advanced.md
new file mode 100644
index 000000000..8828fc38e
--- /dev/null
+++ b/website/versioned_docs/version-5.x/api/connect-advanced.md
@@ -0,0 +1,88 @@
+---
+id: version-5.x-connect-advanced
+title: connectAdvanced
+sidebar_label: connectAdvanced()
+hide_title: true
+original_id: connect-advanced
+---
+
+## connectAdvanced
+
+```js
+connectAdvanced(selectorFactory, [connectOptions])
+```
+
+Connects a React component to a Redux store. It is the base for `connect()` but is less opinionated about how to combine `state`, `props`, and `dispatch` into your final props. It makes no assumptions about defaults or memoization of results, leaving those responsibilities to the caller.
+
+It does not modify the component class passed to it; instead, it *returns* a new, connected component class for you to use.
+
+### Arguments
+
+* `selectorFactory(dispatch, factoryOptions): selector(state, ownProps): props` \(*Function*): Initializes a selector function (during each instance's constructor). That selector function is called any time the connector component needs to compute new props, as a result of a store state change or receiving new props. The result of `selector` is expected to be a plain object, which is passed as the props to the wrapped component. If a consecutive call to `selector` returns the same object (`===`) as its previous call, the component will not be re-rendered. It's the responsibility of `selector` to return that previous object when appropriate.
+
+* [`connectOptions`] *(Object)* If specified, further customizes the behavior of the connector.
+
+ * [`getDisplayName`] *(Function)*: computes the connector component's displayName property relative to that of the wrapped component. Usually overridden by wrapper functions. Default value: `name => 'ConnectAdvanced('+name+')'`
+
+ * [`methodName`] *(String)*: shown in error messages. Usually overridden by wrapper functions. Default value: `'connectAdvanced'`
+
+ * [`renderCountProp`] *(String)*: if defined, a property named this value will be added to the props passed to the wrapped component. Its value will be the number of times the component has been rendered, which can be useful for tracking down unnecessary re-renders. Default value: `undefined`
+
+ * [`shouldHandleStateChanges`] *(Boolean)*: controls whether the connector component subscribes to redux store state changes. If set to false, it will only re-render when parent component re-renders. Default value: `true`
+
+ * [`storeKey`] *(String)*: the key of props/context to get the store. You probably only need this if you are in the inadvisable position of having multiple stores. Default value: `'store'`
+
+ * [`withRef`] *(Boolean)*: If true, stores a ref to the wrapped component instance and makes it available via `getWrappedInstance()` method. Default value: `false`
+
+ * Additionally, any extra options passed via `connectOptions` will be passed through to your `selectorFactory` in the `factoryOptions` argument.
+
+
+
+### Returns
+
+A higher-order React component class that builds props from the store state and passes them to the wrapped component. A higher-order component is a function which accepts a component argument and returns a new component.
+
+#### Static Properties
+
+* `WrappedComponent` *(Component)*: The original component class passed to `connectAdvanced(...)(Component)`.
+
+#### Static Methods
+
+All the original static methods of the component are hoisted.
+
+#### Instance Methods
+
+##### `getWrappedInstance(): ReactComponent`
+
+Returns the wrapped component instance. Only available if you pass `{ withRef: true }` as part of the `options` argument.
+
+### Remarks
+
+* Since `connectAdvanced` returns a higher-order component, it needs to be invoked two times. The first time with its arguments as described above, and a second time, with the component: `connectAdvanced(selectorFactory)(MyComponent)`.
+
+* `connectAdvanced` does not modify the passed React component. It returns a new, connected component, that you should use instead.
+
+
+#### Examples
+
+#### Inject `todos` of a specific user depending on props, and inject `props.userId` into the action
+
+```js
+import * as actionCreators from './actionCreators'
+import { bindActionCreators } from 'redux'
+
+function selectorFactory(dispatch) {
+ let ownProps = {}
+ let result = {}
+ const actions = bindActionCreators(actionCreators, dispatch)
+ const addTodo = (text) => actions.addTodo(ownProps.userId, text)
+ return (nextState, nextOwnProps) => {
+ const todos = nextState.todos[nextOwnProps.userId]
+ const nextResult = { ...nextOwnProps, todos, addTodo }
+ ownProps = nextOwnProps
+ if (!shallowEqual(result, nextResult)) result = nextResult
+ return result
+ }
+}
+export default connectAdvanced(selectorFactory)(TodoApp)
+```
diff --git a/website/versioned_docs/version-5.x/api/connect.md b/website/versioned_docs/version-5.x/api/connect.md
new file mode 100644
index 000000000..b00ac2a12
--- /dev/null
+++ b/website/versioned_docs/version-5.x/api/connect.md
@@ -0,0 +1,325 @@
+---
+id: version-5.x-connect
+title: Connect
+sidebar_label: connect()
+original_id: connect
+---
+
+## connect
+
+```
+connect([mapStateToProps], [mapDispatchToProps], [mergeProps], [options])
+```
+
+Connects a React component to a Redux store. `connect` is a facade around `connectAdvanced`, providing a convenient API for the most common use cases.
+
+It does not modify the component class passed to it; instead, it *returns* a new, connected component class for you to use.
+
+### Arguments
+
+* [`mapStateToProps(state, [ownProps]): stateProps`] \(*Function*): If this argument is specified, the new component will subscribe to Redux store updates. This means that any time the store is updated, `mapStateToProps` will be called. The results of `mapStateToProps` must be a plain object, which will be merged into the component’s props. If you don't want to subscribe to store updates, pass `null` or `undefined` in place of `mapStateToProps`.
+
+ If your `mapStateToProps` function is declared as taking two parameters, it will be called with the store state as the first parameter and the props passed to the connected component as the second parameter, and will also be re-invoked whenever the connected component receives new props as determined by shallow equality comparisons. (The second parameter is normally referred to as `ownProps` by convention.)
+
+ >Note: in advanced scenarios where you need more control over the rendering performance, `mapStateToProps()` can also return a function. In this case, *that* function will be used as `mapStateToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reduxjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
+
+ >The `mapStateToProps` function's first argument is the entire Redux store’s state and it returns an object to be passed as props. It is often called a **selector**. Use [reselect](https://github.com/reduxjs/reselect) to efficiently compose selectors and [compute derived data](https://redux.js.org/recipes/computing-derived-data).
+
+* [`mapDispatchToProps(dispatch, [ownProps]): dispatchProps`] \(*Object* or *Function*): If an object is passed, each function inside it is assumed to be a Redux action creator. An object with the same function names, but with every action creator wrapped into a `dispatch` call so they may be invoked directly, will be merged into the component’s props.
+
+ If a function is passed, it will be given `dispatch` as the first parameter. It’s up to you to return an object that somehow uses `dispatch` to bind action creators in your own way. (Tip: you may use the [`bindActionCreators()`](https://redux.js.org/api-reference/bindactioncreators) helper from Redux.)
+
+ If your `mapDispatchToProps` function is declared as taking two parameters, it will be called with `dispatch` as the first parameter and the props passed to the connected component as the second parameter, and will be re-invoked whenever the connected component receives new props. (The second parameter is normally referred to as `ownProps` by convention.)
+
+ If you do not supply your own `mapDispatchToProps` function or object full of action creators, the default `mapDispatchToProps` implementation just injects `dispatch` into your component’s props.
+
+ >Note: in advanced scenarios where you need more control over the rendering performance, `mapDispatchToProps()` can also return a function. In this case, *that* function will be used as `mapDispatchToProps()` for a particular component instance. This allows you to do per-instance memoization. You can refer to [#279](https://github.com/reduxjs/react-redux/pull/279) and the tests it adds for more details. Most apps never need this.
+
+* [`mergeProps(stateProps, dispatchProps, ownProps): props`] \(*Function*): If specified, it is passed the result of `mapStateToProps()`, `mapDispatchToProps()`, and the parent `props`. The plain object you return from it will be passed as props to the wrapped component. You may specify this function to select a slice of the state based on props, or to bind action creators to a particular variable from props. If you omit it, `Object.assign({}, ownProps, stateProps, dispatchProps)` is used by default.
+
+* [`options`] *(Object)* If specified, further customizes the behavior of the connector. In addition to the options passable to `connectAdvanced()` (see those below), `connect()` accepts these additional options:
+ * [`pure`] *(Boolean)*: If true, `connect()` will avoid re-renders and calls to `mapStateToProps`, `mapDispatchToProps`, and `mergeProps` if the relevant state/props objects remain equal based on their respective equality checks. Assumes that the wrapped component is a “pure” component and does not rely on any input or state other than its props and the selected Redux store’s state. Default value: `true`
+ * [`areStatesEqual`] *(Function)*: When pure, compares incoming store state to its previous value. Default value: `strictEqual (===)`
+ * [`areOwnPropsEqual`] *(Function)*: When pure, compares incoming props to its previous value. Default value: `shallowEqual`
+ * [`areStatePropsEqual`] *(Function)*: When pure, compares the result of `mapStateToProps` to its previous value. Default value: `shallowEqual`
+ * [`areMergedPropsEqual`] *(Function)*: When pure, compares the result of `mergeProps` to its previous value. Default value: `shallowEqual`
+ * [`storeKey`] *(String)*: The key of the context from where to read the store. You probably only need this if you are in the inadvisable position of having multiple stores. Default value: `'store'`
+
+#### The arity of mapStateToProps and mapDispatchToProps determines whether they receive ownProps
+
+> Note: `ownProps` **is not passed** to `mapStateToProps` and `mapDispatchToProps` if the formal definition of the function contains one mandatory parameter (function has length 1). For example, functions defined like below won't receive `ownProps` as the second argument.
+
+```js
+function mapStateToProps(state) {
+ console.log(state); // state
+ console.log(arguments[1]); // undefined
+}
+```
+```js
+const mapStateToProps = (state, ownProps = {}) => {
+ console.log(state); // state
+ console.log(ownProps); // {}
+}
+```
+
+Functions with no mandatory parameters or two parameters **will receive** `ownProps`.
+```js
+const mapStateToProps = (state, ownProps) => {
+ console.log(state); // state
+ console.log(ownProps); // ownProps
+}
+```
+```js
+function mapStateToProps() {
+ console.log(arguments[0]); // state
+ console.log(arguments[1]); // ownProps
+}
+```
+```js
+const mapStateToProps = (...args) => {
+ console.log(args[0]); // state
+ console.log(args[1]); // ownProps
+}
+```
+
+#### Optimizing connect when options.pure is true
+
+When `options.pure` is true, `connect` performs several equality checks that are used to avoid unnecessary calls to `mapStateToProps`, `mapDispatchToProps`, `mergeProps`, and ultimately to `render`. These include `areStatesEqual`, `areOwnPropsEqual`, `areStatePropsEqual`, and `areMergedPropsEqual`. While the defaults are probably appropriate 99% of the time, you may wish to override them with custom implementations for performance or other reasons. Here are several examples:
+
+* You may wish to override `areStatesEqual` if your `mapStateToProps` function is computationally expensive and is also only concerned with a small slice of your state. For example: `areStatesEqual: (next, prev) => prev.entities.todos === next.entities.todos`; this would effectively ignore state changes for everything but that slice of state.
+
+* You may wish to override `areStatesEqual` to always return false (`areStatesEqual: () => false`) if you have impure reducers that mutate your store state. (This would likely impact the other equality checks as well, depending on your `mapStateToProps` function.)
+
+* You may wish to override `areOwnPropsEqual` as a way to whitelist incoming props. You'd also have to implement `mapStateToProps`, `mapDispatchToProps` and `mergeProps` to also whitelist props. (It may be simpler to achieve this other ways, for example by using [recompose's mapProps](https://github.com/acdlite/recompose/blob/master/docs/API.md#mapprops).)
+
+* You may wish to override `areStatePropsEqual` to use `strictEqual` if your `mapStateToProps` uses a memoized selector that will only return a new object if a relevant prop has changed. This would be a very slight performance improvement, since would avoid extra equality checks on individual props each time `mapStateToProps` is called.
+
+* You may wish to override `areMergedPropsEqual` to implement a `deepEqual` if your selectors produce complex props. ex: nested objects, new arrays, etc. (The deep equal check should be faster than just re-rendering.)
+
+### Returns
+
+A higher-order React component class that passes state and action creators into your component derived from the supplied arguments. This is created by `connectAdvanced`, and details of this higher-order component are covered there.
+
+
+#### Examples
+
+#### Inject just `dispatch` and don't listen to store
+
+```js
+export default connect()(TodoApp)
+```
+
+#### Inject all action creators (`addTodo`, `completeTodo`, ...) without subscribing to the store
+
+```js
+import * as actionCreators from './actionCreators'
+
+export default connect(null, actionCreators)(TodoApp)
+```
+
+#### Inject `dispatch` and every field in the global state
+
+>Don’t do this! It kills any performance optimizations because `TodoApp` will rerender after every state change.
+>It’s better to have more granular `connect()` on several components in your view hierarchy that each only
+>listen to a relevant slice of the state.
+
+```js
+export default connect(state => state)(TodoApp)
+```
+
+#### Inject `dispatch` and `todos`
+
+```js
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+export default connect(mapStateToProps)(TodoApp)
+```
+
+#### Inject `todos` and all action creators
+
+```js
+import * as actionCreators from './actionCreators'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+export default connect(mapStateToProps, actionCreators)(TodoApp)
+```
+
+#### Inject `todos` and all action creators (`addTodo`, `completeTodo`, ...) as `actions`
+
+```js
+import * as actionCreators from './actionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return { actions: bindActionCreators(actionCreators, dispatch) }
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos` and a specific action creator (`addTodo`)
+
+```js
+import { addTodo } from './actionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return bindActionCreators({ addTodo }, dispatch)
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos` and specific action creators (`addTodo` and `deleteTodo`) with shorthand syntax
+
+```js
+import { addTodo, deleteTodo } from './actionCreators'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+const mapDispatchToProps = {
+ addTodo,
+ deleteTodo
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos`, todoActionCreators as `todoActions`, and counterActionCreators as `counterActions`
+
+```js
+import * as todoActionCreators from './todoActionCreators'
+import * as counterActionCreators from './counterActionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return {
+ todoActions: bindActionCreators(todoActionCreators, dispatch),
+ counterActions: bindActionCreators(counterActionCreators, dispatch)
+ }
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos`, and todoActionCreators and counterActionCreators together as `actions`
+
+```js
+import * as todoActionCreators from './todoActionCreators'
+import * as counterActionCreators from './counterActionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return {
+ actions: bindActionCreators(Object.assign({}, todoActionCreators, counterActionCreators), dispatch)
+ }
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos`, and all todoActionCreators and counterActionCreators directly as props
+
+```js
+import * as todoActionCreators from './todoActionCreators'
+import * as counterActionCreators from './counterActionCreators'
+import { bindActionCreators } from 'redux'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mapDispatchToProps(dispatch) {
+ return bindActionCreators(Object.assign({}, todoActionCreators, counterActionCreators), dispatch)
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TodoApp)
+```
+
+#### Inject `todos` of a specific user depending on props
+
+```js
+import * as actionCreators from './actionCreators'
+
+function mapStateToProps(state, ownProps) {
+ return { todos: state.todos[ownProps.userId] }
+}
+
+export default connect(mapStateToProps)(TodoApp)
+```
+
+#### Inject `todos` of a specific user depending on props, and inject `props.userId` into the action
+
+```js
+import * as actionCreators from './actionCreators'
+
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+function mergeProps(stateProps, dispatchProps, ownProps) {
+ return Object.assign({}, ownProps, {
+ todos: stateProps.todos[ownProps.userId],
+ addTodo: (text) => dispatchProps.addTodo(ownProps.userId, text)
+ })
+}
+
+export default connect(mapStateToProps, actionCreators, mergeProps)(TodoApp)
+```
+
+#### Factory functions
+
+Factory functions can be used for performance optimizations
+
+```js
+import { addTodo } from './actionCreators'
+
+function mapStateToPropsFactory(initialState, initialProps) {
+ const getSomeProperty= createSelector(...);
+ const anotherProperty = 200 + initialState[initialProps.another];
+ return function(state){
+ return {
+ anotherProperty,
+ someProperty: getSomeProperty(state),
+ todos: state.todos
+ }
+ }
+}
+
+function mapDispatchToPropsFactory(initialState, initialProps) {
+ function goToSomeLink(){
+ initialProps.history.push('some/link');
+ }
+ return function(dispatch){
+ return {
+ addTodo
+ }
+ }
+}
+
+
+export default connect(mapStateToPropsFactory, mapDispatchToPropsFactory)(TodoApp)
+```
diff --git a/website/versioned_docs/version-5.x/introduction/basic-tutorial.md b/website/versioned_docs/version-5.x/introduction/basic-tutorial.md
new file mode 100644
index 000000000..785fc0cdd
--- /dev/null
+++ b/website/versioned_docs/version-5.x/introduction/basic-tutorial.md
@@ -0,0 +1,459 @@
+---
+id: version-5.x-basic-tutorial
+title: Basic Tutorial
+hide_title: true
+sidebar_label: Basic Tutorial
+original_id: basic-tutorial
+---
+
+# Basic Tutorial
+
+To see how to use React-Redux in practice, we’ll show a step-by-step example by creating a todo list app.
+
+## A Todo List Example
+
+**Jump to**
+
+- 🤞 [Just show me the code](https://codesandbox.io/s/9on71rvnyo)
+- 👆 [Providing the store](#providing-the-store)
+- ✌️ [Connecting the Component](#connecting-the-components)
+
+**The React UI Components**
+
+We have implemented our React UI components as follows:
+
+- `TodoApp` is the entry component for our app. It renders the header, the `AddTodo`, `TodoList`, and `VisibilityFilters` components.
+- `AddTodo` is the component that allows a user to input a todo item and add to the list upon clicking its “Add Todo” button:
+ - It uses a controlled input that sets state upon `onChange`.
+ - When the user clicks on the “Add Todo” button, it dispatches the action (that we will provide using React-Redux) to add the todo to the store.
+- `TodoList` is the component that renders the list of todos:
+ - It renders the filtered list of todos when one of the `VisibilityFilters` is selected.
+- `Todo` is the component that renders a single todo item:
+ - It renders the todo content, and shows that a todo is completed by crossing it out.
+ - It dispatches the action to toggle the todo's complete status upon `onClick`.
+- `VisibilityFilters` renders a simple set of filters: _all_, _completed_, and _incomplete._ Clicking on each one of them filters the todos:
+ - It accepts an `activeFilter` prop from the parent that indicates which filter is currently selected by the user. An active filter is rendered with an underscore.
+ - It dispatches the `setFilter` action to update the selected filter.
+- `constants` holds the constants data for our app.
+- And finally `index` renders our app to the DOM.
+
+
+
+**The Redux Store**
+
+The Redux portion of the application has been set up using the [patterns recommended in the Redux docs](https://redux.js.org):
+
+- Store
+ - `todos`: A normalized reducer of todos. It contains a `byIds` map of all todos and a `allIds` that contains the list of all ids.
+ - `visibilityFilters`: A simple string `all`, `completed`, or `incomplete`.
+- Action Creators
+ - `addTodo` creates the action to add todos. It takes a single string variable `content` and returns an `ADD_TODO` action with `payload` containing a self-incremented `id` and `content`
+ - `toggleTodo` creates the action to toggle todos. It takes a single number variable `id` and returns a `TOGGLE_TODO` action with `payload` containing `id` only
+ - `setFilter` creates the action to set the app’s active filter. It takes a single string variable `filter` and returns a `SET_FILTER` action with `payload` containing the `filter` itself
+- Reducers
+ - The `todos` reducer
+ - Appends the `id` to its `allIds` field and sets the todo within its `byIds` field upon receiving the `ADD_TODO` action
+ - Toggles the `completed` field for the todo upon receiving the `TOGGLE_TODO` action
+ - The `visibilityFilters` reducer sets its slice of store to the new filter it receives from the `SET_FILTER` action payload
+- Action Types
+ - We use a file `actionTypes.js` to hold the constants of action types to be reused
+- Selectors
+ - `getTodoList` returns the `allIds` list from the `todos` store
+ - `getTodoById` finds the todo in the store given by `id`
+ - `getTodos` is slightly more complex. It takes all the `id`s from `allIds`, finds each todo in `byIds`, and returns the final array of todos
+ - `getTodosByVisibilityFilter` filters the todos according to the visibility filter
+
+You may check out [this CodeSandbox](https://codesandbox.io/s/6vwyqrpqk3) for the source code of the UI components and the unconnected Redux store described above.
+
+
+
+We will now show how to connect this store to our app using React-Redux.
+
+### Providing the Store
+
+First we need to make the `store` available to our app. To do this, we wrap our app with the `` API provided by React-Redux.
+
+```jsx
+// index.js
+import React from "react";
+import ReactDOM from "react-dom";
+import TodoApp from "./TodoApp";
+
+import { Provider } from "react-redux";
+import store from "./redux/store";
+
+const rootElement = document.getElementById("root");
+ReactDOM.render(
+
+
+ ,
+ rootElement
+);
+```
+
+Notice how our `` is now wrapped with the `` with `store` passed in as a prop.
+
+
+
+### Connecting the Components
+
+React-Redux provides a `connect` function for you to read values from the Redux store (and re-read the values when the store updates).
+
+The `connect` function takes two arguments, both optional:
+
+- `mapStateToProps`: called every time the store state changes. It receives the entire store state, and should return an object of data this component needs.
+
+- `mapDispatchToProps`: this parameter can either be a function, or an object.
+ - If it’s a function, it will be called once on component creation. It will receive `dispatch` as an argument, and should return an object full of functions that use `dispatch` to dispatch actions.
+ - If it’s an object full of action creators, each action creator will be turned into a prop function that automatically dispatches its action when called. **Note**: We recommend using this “object shorthand” form.
+
+Normally, you’ll call `connect` in this way:
+
+```js
+const mapStateToProps = (state, ownProps) => ({
+ // ... computed data from state and optionally ownProps
+});
+
+const mapDispatchToProps = {
+ // ... normally is an object full of action creators
+};
+
+// `connect` returns a new function that accepts the component to wrap:
+const connectToStore = connect(
+ mapStateToProps,
+ mapDispatchToProps
+);
+// and that function returns the connected, wrapper component:
+const ConnectedComponent = connectToStore(Component);
+
+// We normally do both in one step, like this:
+connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(Component);
+```
+
+Let’s work on `` first. It needs to trigger changes to the `store` to add new todos. Therefore, it needs to be able to `dispatch` actions to the store. Here’s how we do it.
+
+Our `addTodo` action creator looks like this:
+
+```js
+// redux/actions.js
+import { ADD_TODO } from "./actionTypes";
+
+let nextTodoId = 0;
+export const addTodo = content => ({
+ type: ADD_TODO,
+ payload: {
+ id: ++nextTodoId,
+ content
+ }
+});
+
+// ... other actions
+```
+
+By passing it to `connect`, our component receives it as a prop, and it will automatically dispatch the action when it’s called.
+
+```js
+// components/AddTodo.js
+
+// ... other imports
+import { connect } from "react-redux";
+import { addTodo } from "../redux/actions";
+
+class AddTodo extends React.Component {
+ // ... component implementation
+}
+
+export default connect(
+ null,
+ { addTodo }
+)(AddTodo);
+```
+
+Notice now that `` is wrapped with a parent component called ``. Meanwhile, `` now gains one prop: the `addTodo` action.
+
+
+
+We also need to implement the `handleAddTodo` function to let it dispatch the `addTodo` action and reset the input
+
+```jsx
+// components/AddTodo.js
+
+import React from "react";
+import { connect } from "react-redux";
+import { addTodo } from "../redux/actions";
+
+class AddTodo extends React.Component {
+ // ...
+
+ handleAddTodo = () => {
+ // dispatches actions to add todo
+ this.props.addTodo(this.state.input);
+
+ // sets state back to empty string
+ this.setState({ input: "" });
+ };
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+export default connect(
+ null,
+ { addTodo }
+)(AddTodo);
+```
+
+Now our `` is connected to the store. When we add a todo it would dispatch an action to change the store. We are not seeing it in the app because the other components are not connected yet. If you have the Redux DevTools Extension hooked up, you should see the action being dispatched:
+
+
+
+You should also see that the store has changed accordingly:
+
+
+
+The `` component is responsible for rendering the list of todos. Therefore, it needs to read data from the store. We enable it by calling `connect` with the `mapStateToProps` parameter, a function describing which part of the data we need from the store.
+
+Our `` component takes the todo item as props. We have this information from the `byIds` field of the `todos`. However, we also need the information from the `allIds` field of the store indicating which todos and in what order they should be rendered. Our `mapStateToProps` function may look like this:
+
+```js
+// components/TodoList.js
+
+// ...other imports
+import { connect } from "react-redux";
+
+const TodoList = // ... UI component implementation
+
+const mapStateToProps = state => {
+ const { byIds, allIds } = state.todos || {};
+ const todos =
+ allIds && allIds.length
+ ? allIds.map(id => (byIds ? { ...byIds[id], id } : null))
+ : null;
+ return { todos };
+};
+
+export default connect(mapStateToProps)(TodoList);
+```
+
+Luckily we have a selector that does exactly this. We may simply import the selector and use it here.
+
+```js
+// redux/selectors.js
+
+export const getTodosState = store => store.todos;
+
+export const getTodoList = store =>
+ getTodosState(store) ? getTodosState(store).allIds : [];
+
+export const getTodoById = (store, id) =>
+ getTodosState(store) ? { ...getTodosState(store).byIds[id], id } : {};
+
+export const getTodos = store =>
+ getTodoList(store).map(id => getTodoById(store, id));
+```
+
+```js
+// components/TodoList.js
+
+// ...other imports
+import { connect } from "react-redux";
+import { getTodos } from "../redux/selectors";
+
+const TodoList = // ... UI component implementation
+
+export default connect(state => ({ todos: getTodos(state) }))(TodoList);
+```
+
+We recommend encapsulating any complex lookups or computations of data in selector functions. In addition, you can further optimize the performance by using [Reselect](https://github.com/reduxjs/reselect) to write “memoized” selectors that can skip unnecessary work. (See [the Redux docs page on Computing Derived Data](https://redux.js.org/recipes/computingderiveddata#sharing-selectors-across-multiple-components) and the blog post [Idiomatic Redux: Using Reselect Selectors for Encapsulation and Performance](https://blog.isquaredsoftware.com/2017/12/idiomatic-redux-using-reselect-selectors/) for more information on why and how to use selector functions.)
+
+Now that our `` is connected to the store. It should receive the list of todos, map over them, and pass each todo to the `` component. `` will in turn render them to the screen. Now try adding a todo. It should come up on our todo list!
+
+
+
+We will connect more components. Before we do this, let’s pause and learn a bit more about `connect` first.
+
+### Common ways of calling `connect`
+
+Depending on what kind of components you are working with, there are different ways of calling `connect` , with the most common ones summarized as below:
+
+| | Do Not Subscribe to the Store | Subscribe to the Store |
+| ----------------------------- | ---------------------------------------------- | --------------------------------------------------------- |
+| Do Not Inject Action Creators | `connect()(Component)` | `connect(mapStateToProps)(Component)` |
+| Inject Action Creators | `connect(null, mapDispatchToProps)(Component)` | `connect(mapStateToProps, mapDispatchToProps)(Component)` |
+
+#### Do not subscribe to the store and do not inject action creators
+
+If you call `connect` without providing any arguments, your component will:
+
+- _not_ re-render when the store changes
+- receive `props.dispatch` that you may use to manually dispatch action
+
+```js
+// ... Component
+export default connect()(Component); // Component will receive `dispatch` (just like our !)
+```
+
+#### Subscribe to the store and do not inject action creators
+
+If you call `connect` with only `mapStateToProps`, your component will:
+
+- subscribe to the values that `mapStateToProps` extracts from the store, and re-render only when those values have changed
+- receive `props.dispatch` that you may use to manually dispatch action
+
+```js
+// ... Component
+const mapStateToProps = state => state.partOfState;
+export default connect(mapStateToProps)(Component);
+```
+
+#### Do not subscribe to the store and inject action creators
+
+If you call `connect` with only `mapDispatchToProps`, your component will:
+
+- _not_ re-render when the store changes
+- receive each of the action creators you inject with `mapDispatchToProps` as props and automatically dispatch the actions upon being called
+
+```js
+import { addTodo } from "./actionCreators";
+// ... Component
+export default connect(
+ null,
+ { addTodo }
+)(Component);
+```
+
+#### Subscribe to the store and inject action creators
+
+If you call `connect` with both `mapStateToProps` and `mapDispatchToProps`, your component will:
+
+- subscribe to the values that `mapStateToProps` extracts from the store, and re-render only when those values have changed
+- receive all of the action creators you inject with `mapDispatchToProps` as props and automatically dispatch the actions upon being called.
+
+```js
+import * as actionCreators from "./actionCreators";
+// ... Component
+const mapStateToProps = state => state.partOfState;
+export default connect(
+ mapStateToProps,
+ actionCreators
+)(Component);
+```
+
+These four cases cover the most basic usages of `connect`. To read more about `connect`, continue reading our [API section](./api.md) that explains it in more detail.
+
+
+
+---
+
+Now let’s connect the rest of our ``.
+
+How should we implement the interaction of toggling todos? A keen reader might already have an answer. If you have your environment set up and have followed through up until this point, now is a good time to leave it aside and implement the feature by yourself. There would be no surprise that we connect our `` to dispatch `toggleTodo` in a similar way:
+
+```js
+// components/Todo.js
+
+// ... other imports
+import { connect } from "react-redux";
+import { toggleTodo } from "../redux/actions";
+
+const Todo = // ... component implementation
+
+export default connect(
+ null,
+ { toggleTodo }
+)(Todo);
+```
+
+Now our todo’s can be toggled complete. We’re almost there!
+
+
+
+Finally, let’s implement our `VisibilityFilters` feature.
+
+The `` component needs to be able to read from the store which filter is currently active, and dispatch actions to the store. Therefore, we need to pass both a `mapStateToProps` and `mapDispatchToProps`. The `mapStateToProps` here can be a simple accessor of the `visibilityFilter` state. And the `mapDispatchToProps` will contain the `setFilter` action creator.
+
+```js
+// components/VisibilityFilters.js
+
+// ... other imports
+import { connect } from "react-redux";
+import { setFilter } from "../redux/actions";
+
+const VisibilityFilters = // ... component implementation
+
+const mapStateToProps = state => {
+ return { activeFilter: state.visibilityFilter };
+};
+export default connect(
+ mapStateToProps,
+ { setFilter }
+)(VisibilityFilters);
+```
+
+Meanwhile, we also need to update our `` component to filter todos according to the active filter. Previously the `mapStateToProps` we passed to the `` `connect` function call was simply the selector that selects the whole list of todos. Let’s write another selector to help filtering todos by their status.
+
+```js
+// redux/selectors.js
+
+// ... other selectors
+export const getTodosByVisibilityFilter = (store, visibilityFilter) => {
+ const allTodos = getTodos(store);
+ switch (visibilityFilter) {
+ case VISIBILITY_FILTERS.COMPLETED:
+ return allTodos.filter(todo => todo.completed);
+ case VISIBILITY_FILTERS.INCOMPLETE:
+ return allTodos.filter(todo => !todo.completed);
+ case VISIBILITY_FILTERS.ALL:
+ default:
+ return allTodos;
+ }
+};
+```
+
+And connecting to the store with the help of the selector:
+
+```js
+// components/TodoList.js
+
+// ...
+
+const mapStateToProps = state => {
+ const { visibilityFilter } = state;
+ const todos = getTodosByVisibilityFilter(state, visibilityFilter);
+ return { todos };
+};
+
+export default connect(mapStateToProps)(TodoList);
+```
+
+Now we've finished a very simple example of a todo app with React-Redux. All our components are connected! Isn't that nice? 🎉🎊
+
+
+
+## Links
+
+- [Usage with React](https://redux.js.org/basics/usagewithreact)
+- [Using the React-Redux Bindings](https://blog.isquaredsoftware.com/presentations/workshops/redux-fundamentals/react-redux.html)
+- [Higher Order Components in Depth](https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e)
+- [Computing Derived Data](https://redux.js.org/recipes/computingderiveddata#sharing-selectors-across-multiple-components)
+- [Idiomatic Redux: Using Reselect Selectors for Encapsulation and Performance](https://blog.isquaredsoftware.com/2017/12/idiomatic-redux-using-reselect-selectors/)
+
+## Get More Help
+
+- [Reactiflux](https://www.reactiflux.com) Redux channel
+- [StackOverflow](https://stackoverflow.com/questions/tagged/react-redux)
+- [GitHub Issues](https://github.com/reduxjs/react-redux/issues/)
diff --git a/website/versioned_docs/version-5.x/introduction/quick-start.md b/website/versioned_docs/version-5.x/introduction/quick-start.md
new file mode 100644
index 000000000..24823a0a1
--- /dev/null
+++ b/website/versioned_docs/version-5.x/introduction/quick-start.md
@@ -0,0 +1,71 @@
+---
+id: version-5.x-quick-start
+title: Quick Start
+hide_title: true
+sidebar_label: Quick Start
+original_id: quick-start
+---
+
+# Quick Start
+
+[React-Redux](https://github.com/reduxjs/react-redux) is the official [React](https://reactjs.org/) binding for [Redux](https://redux.js.org/). It lets your React components read data from a Redux store, and dispatch actions to the store to update data.
+
+## Installation
+
+To use React-Redux with your React app:
+
+```bash
+npm install --save react-redux
+```
+
+or
+
+```bash
+yarn add react-redux
+```
+
+## `Provider` and `connect`
+
+React-Redux provides ``, which makes the Redux store available to the rest of your app:
+
+```js
+import React from "react";
+import ReactDOM from "react-dom";
+
+import { Provider } from "react-redux";
+import store from "./store";
+
+import App from "./App";
+
+const rootElement = document.getElementById("root");
+ReactDOM.render(
+
+
+ ,
+ rootElement
+);
+```
+
+React-Redux provides a `connect` function for you to connect your component to the store.
+
+Normally, you’ll call `connect` in this way:
+
+```js
+import { connect } from "react-redux";
+import { increment, decrement, reset } from "./actionCreators";
+
+// const Counter = ...
+
+const mapStateToProps = (state /*, ownProps*/) => {
+ return {
+ counter: state.counter
+ };
+};
+
+const mapDispatchToProps = { increment, decrement, reset };
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(Counter);
+```
diff --git a/website/versioned_docs/version-5.x/introduction/why-use-react-redux.md b/website/versioned_docs/version-5.x/introduction/why-use-react-redux.md
new file mode 100644
index 000000000..cf5cd4aa8
--- /dev/null
+++ b/website/versioned_docs/version-5.x/introduction/why-use-react-redux.md
@@ -0,0 +1,98 @@
+---
+id: version-5.x-why-use-react-redux
+title: Why Use React-Redux?
+hide_title: true
+sidebar_label: Why Use React-Redux?
+original_id: why-use-react-redux
+---
+
+# Why Use React-Redux?
+
+Redux itself is a standalone library that can be used with any UI layer or framework, including React, Angular, Vue, Ember, and vanilla JS. Although Redux and React are commonly used together, they are independent of each other.
+
+If you are using Redux with any kind of UI framework, you will normally use a "UI binding" library to tie Redux together with your UI framework, rather than directly interacting with the store from your UI code.
+
+**React-Redux is the official Redux UI binding library for React**. If you are using Redux and React together, you should also use React-Redux to bind these two libraries.
+
+To understand why you should use React-Redux, it may help to understand what a "UI binding library" does.
+
+> **Note**: If you have questions about whether you should use Redux in general, please see these articles for discussion of when and why you might want to use Redux, and how it's intended to be used:
+>
+> - [Redux docs: Motivation](https://redux.js.org/introduction/motivation)
+> - [Redux docs: FAQ - When should I use Redux?](https://redux.js.org/faq/general#when-should-i-use-redux)
+> - [You Might Not Need Redux](https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367)
+> - [Idiomatic Redux: The Tao of Redux, Part 1 - Implementation and Intent](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-1/)
+
+
+## Integrating Redux with a UI
+
+Using Redux with _any_ UI layer requires [the same consistent set of steps](https://blog.isquaredsoftware.com/presentations/workshops/redux-fundamentals/ui-layer.html#/4):
+
+1. Create a Redux store
+2. Subscribe to updates
+3. Inside the subscription callback:
+ 1. Get the current store state
+ 2. Extract the data needed by this piece of UI
+ 3. Update the UI with the data
+4. If necessary, render the UI with initial state
+5. Respond to UI inputs by dispatching Redux actions
+
+While it is possible to write this logic by hand, doing so would become very repetitive. In addition, optimizing UI performance would require complicated logic.
+
+The process of subscribing to the store, checking for updated data, and triggering a re-render can be made more generic and reusable. **A UI binding library like React-Redux handles the store interaction logic, so you don't have to write that code yourself.**
+
+
+## Reasons to Use React-Redux
+
+### It is the Official Redux UI Bindings for React
+
+While Redux can be used with any UI layer, it was originally designed and intended for use with React. There are [UI binding layers for many other frameworks](https://redux.js.org/introduction/ecosystem#library-integration-and-bindings), but React-Redux is maintained directly by the Redux team.
+
+As the offical Redux binding for React, React-Redux is kept up-to-date with any API changes from either library, to ensure that your React components behave as expected. Its intended usage adopts the design principles of React - writing declarative components.
+
+
+### It Encourages Good React Architecture
+
+React components are a lot like functions. While it's possible to write all your code in a single function, it's usually better to split that logic into smaller functions that each handle a specific task, making them easier to understand.
+
+Similarly, while you can write large React components that handle many different tasks, it's usually better to split up components based on responsibilities. In particular, it is common to have "container" components that are responsible for collecting and managing some kind of data, and "presentational" components that simply display UI based on whatever data they've received as props.
+
+**The React-Redux `connect` function generates "container" wrapper components that handle the process of interacting with the store for you**. That way, your own components can focus on other tasks, whether it be collecting other data, or just displaying a piece of the UI. In addition, **`connect` abstracts away the question of _which_ store is being used, making your own components more reusable**.
+
+As a general architectural principle, **we want to keep our own components "unaware" of Redux**. They should simply receive data and functions as props, just like any other React component. This ultimately makes it easier to test and reuse your own components.
+
+
+### It Implements Performance Optimizations For You
+
+React is generally fast, but by default any updates to a component will cause React to re-render all of the components inside that part of the component tree. This does require work, and if the data for a given component hasn't changed, then re-rendering is likely some wasted effort because the requested UI output would be the same.
+
+If performance is a concern, the best way to improve performance is to skip unnecessary re-renders, so that components only re-render when their data has actually changed. **React-Redux implements many performance optimizations internally, so that your own component only re-renders when it actually needs to.**
+
+In addition, by connecting multiple components in your React component tree, you can ensure that each connected component only extracts the specific pieces of data from the store state that are needed by that component. This means that your own component will need to re-render less often, because most of the time those specific pieces of data haven't changed.
+
+
+### Community Support
+
+As the official binding library for React and Redux, React-Redux has a large community of users. This makes it easier to ask for help, learn about best practices, use libraries that build on top of React-Redux, and reuse your knowledge across different applications.
+
+
+
+## Links and References
+
+
+### Understanding React-Redux
+
+- [Idiomatic Redux: The History and Implementation of React-Redux](https://blog.isquaredsoftware.com/2018/11/react-redux-history-implementation/)
+- [`connect.js` Explained](https://gist.github.com/gaearon/1d19088790e70ac32ea636c025ba424e)
+- [Redux Fundamentals workshop slides](https://blog.isquaredsoftware.com/2018/06/redux-fundamentals-workshop-slides/)
+ - [UI Layer Integration](https://blog.isquaredsoftware.com/presentations/workshops/redux-fundamentals/ui-layer.html)
+ - [Using React-Redux](https://blog.isquaredsoftware.com/presentations/workshops/redux-fundamentals/react-redux.html)
+
+
+### Community Resources
+
+- Discord channel: [#redux on Reactiflux](https://gist.github.com/gaearon/1d19088790e70ac32ea636c025ba424e) ([Reactiflux invite link](https://reactiflux.com))
+- Stack Overflow topics: [Redux](https://stackoverflow.com/questions/tagged/redux), [React-Redux](https://stackoverflow.com/questions/tagged/redux)
+- Reddit: [/r/reactjs](https://www.reddit.com/r/reactjs/), [/r/reduxjs](https://www.reddit.com/r/reduxjs/)
+- Github issues (bug reports and feature requests): https://github.com/reduxjs/react-redux/issues
+- Tutorials, articles, and further resources: [React/Redux Links](https://www.reddit.com/r/reduxjs/)
\ No newline at end of file
diff --git a/website/versioned_docs/version-5.x/troubleshooting.md b/website/versioned_docs/version-5.x/troubleshooting.md
new file mode 100644
index 000000000..83d662db5
--- /dev/null
+++ b/website/versioned_docs/version-5.x/troubleshooting.md
@@ -0,0 +1,88 @@
+---
+id: version-5.x-troubleshooting
+title: Troubleshooting
+sidebar_label: Troubleshooting
+hide_title: true
+original_id: troubleshooting
+---
+
+## Troubleshooting
+
+Make sure to check out [Troubleshooting Redux](http://redux.js.org/docs/Troubleshooting.html) first.
+
+### I'm getting the following alert: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
+This warning is shown when using react 15.5.*. Basically, now it's just a warning, but in react16 the application might break. the PropTypes should now be imported from 'prop-types' package, and not from the react package.
+
+Update to the latest version of react-redux.
+
+### My views aren’t updating!
+
+See the link above.
+In short,
+
+* Reducers should never mutate state, they must return new objects, or React Redux won’t see the updates.
+* Make sure you either bind action creators with the `mapDispatchToProps` argument to `connect()` or with the `bindActionCreators()` method, or that you manually call `dispatch()`. Just calling your `MyActionCreators.addTodo()` function won’t work because it just *returns* an action, but does not *dispatch* it.
+
+### My views aren’t updating on route change with React Router 0.13
+
+If you’re using React Router 0.13, you might [bump into this problem](https://github.com/reduxjs/react-redux/issues/43). The solution is simple: whenever you use `` or the `Handler` provided by `Router.run`, pass the router state to it.
+
+Root view:
+
+```jsx
+Router.run(routes, Router.HistoryLocation, (Handler, routerState) => { // note "routerState" here
+ ReactDOM.render(
+
+ {/* note "routerState" here */}
+
+ ,
+ document.getElementById('root')
+ )
+})
+```
+
+Nested view:
+
+```js
+render() {
+ // Keep passing it down
+ return
+}
+```
+
+Conveniently, this gives your components access to the router state!
+You can also upgrade to React Router 1.0 which shouldn’t have this problem. (Let us know if it does!)
+
+### My views aren’t updating when something changes outside of Redux
+
+If your views depend on global state or [React “context”](http://facebook.github.io/react/docs/context.html), you might find that views decorated with `connect()` will fail to update.
+
+>This is because `connect()` implements [shouldComponentUpdate](https://facebook.github.io/react/docs/component-specs.html#updating-shouldcomponentupdate) by default, assuming that your component will produce the same results given the same props and state. This is a similar concept to React’s [PureRenderMixin](https://facebook.github.io/react/docs/pure-render-mixin.html).
+
+The _best_ solution to this is to make sure that your components are pure and pass any external state to them via props. This will ensure that your views do not re-render unless they actually need to re-render and will greatly speed up your application.
+
+If that’s not practical for whatever reason (for example, if you’re using a library that depends heavily on React context), you may pass the `pure: false` option to `connect()`:
+
+```js
+function mapStateToProps(state) {
+ return { todos: state.todos }
+}
+
+export default connect(mapStateToProps, null, null, {
+ pure: false
+})(TodoApp)
+```
+
+This will remove the assumption that `TodoApp` is pure and cause it to update whenever its parent component renders. Note that this will make your application less performant, so only do this if you have no other option.
+
+### Could not find "store" in either the context or props
+
+If you have context issues,
+
+1. [Make sure you don’t have a duplicate instance of React](https://medium.com/@dan_abramov/two-weird-tricks-that-fix-react-7cf9bbdef375) on the page.
+2. Make sure you didn’t forget to wrap your root or some other ancestor component in [``](#provider-store).
+3. Make sure you’re running the latest versions of React and React Redux.
+
+### Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you’re trying to add a ref to a component that doesn’t have an owner
+
+If you’re using React for web, this usually means you have a [duplicate React](https://medium.com/@dan_abramov/two-weird-tricks-that-fix-react-7cf9bbdef375). Follow the linked instructions to fix this.
diff --git a/website/versioned_docs/version-5.x/using-react-redux/connect-dispatching-actions-with-mapDispatchToProps.md b/website/versioned_docs/version-5.x/using-react-redux/connect-dispatching-actions-with-mapDispatchToProps.md
new file mode 100644
index 000000000..b45c40e76
--- /dev/null
+++ b/website/versioned_docs/version-5.x/using-react-redux/connect-dispatching-actions-with-mapDispatchToProps.md
@@ -0,0 +1,407 @@
+---
+id: version-5.x-connect-mapdispatch
+title: Connect: Dispatching Actions with mapDispatchToProps
+hide_title: true
+sidebar_label: Connect: Dispatching Actions with mapDispatchToProps
+original_id: connect-mapdispatch
+---
+
+# Connect: Dispatching Actions with `mapDispatchToProps`
+
+As the second argument passed in to `connect`, `mapDispatchToProps` is used for dispatching actions to the store.
+
+`dispatch` is a function of the Redux store. You call `store.dispatch` to dispatch an action.
+This is the only way to trigger a state change.
+
+With React-Redux, your components never access the store directly - `connect` does it for you.
+React-Redux gives you two ways to let components dispatch actions:
+
+- By default, a connected component receives `props.dispatch` and can dispatch actions itself.
+- `connect` can accept an argument called `mapDispatchToProps`, which lets you create functions that dispatch when called, and pass those functions as props to your component.
+
+The `mapDispatchToProps` functions are normally referred to as `mapDispatch` for short, but the actual variable name used can be whatever you want.
+
+## Approaches for Dispatching
+
+### Default: `dispatch` as a Prop
+
+If you don't specify the second argument to `connect()`, your component will receive `dispatch` by default. For example:
+
+```js
+connect()(MyComponent);
+// which is equivalent with
+connect(
+ null,
+ null
+)(MyComponent);
+
+// or
+connect(mapStateToProps /** no second argument */)(MyComponent);
+```
+
+Once you have connected your component in this way, your component receives `props.dispatch`. You may use it to dispatch actions to the store.
+
+```js
+function Counter({ count, dispatch }) {
+ return (
+
+
+ {count}
+
+
+
+ );
+}
+```
+
+### Providing A `mapDispatchToProps` Parameter
+
+Providing a `mapDispatchToProps` allows you to specify which actions your component might need to dispatch. It lets you provide action dispatching functions as props. Therefore, instead of calling `props.dispatch(() => increment())`, you may call `props.increment()` directly. There are a few reasons why you might want to do that.
+
+#### More Declarative
+
+First, encapsulating the dispatch logic into function makes the implementation more declarative.
+Dispatching an action and letting the Redux store handle the data flow is _how to_ implement the behavior, rather than _what_ it does.
+
+A good example would be dispatching an action when a button is clicked. Connecting the button directly probably doesn't make sense conceptually, and neither does having the button reference `dispatch`.
+
+```js
+// button needs to be aware of "dispatch"
+