Skip to content

Commit 9005c4a

Browse files
authoredMar 20, 2021
Drop versioned docs entirely (#1696)
1 parent 45dfd45 commit 9005c4a

19 files changed

+249
-425
lines changed
 

‎docs/README.md

-12
This file was deleted.

‎docs/api/Provider.md

+4-47
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ hide_title: true
99

1010
## Overview
1111

12-
The `<Provider />` makes the Redux `store` available to any nested components that have been wrapped in the `connect()` function.
12+
The `<Provider>` component makes the Redux `store` available to any nested components that need to access the Redux store.
1313

14-
Since any React component in a React Redux app can be connected, most applications will render a `<Provider>` at the top level, with the entire app’s component tree inside of it.
14+
Since any React component in a React Redux app can be connected to the store, most applications will render a `<Provider>` at the top level, with the entire app’s component tree inside of it.
1515

16-
Normally, you can’t use a connected component unless it is nested inside of a `<Provider>`.
16+
The [Hooks](./hooks.md) and [`connect`](./connect.md) APIs can then access the provided store instance via React's Context mechanism.
1717

1818
### Props
1919

@@ -30,29 +30,12 @@ You may provide a context instance. If you do so, you will need to provide the s
3030
>
3131
> Could not find "store" in the context of "Connect(MyComponent)". Either wrap the root component in a `<Provider>`, or pass a custom React context provider to `<Provider>` and the corresponding React context consumer to Connect(Todo) in connect options.
3232
33-
**Note:** You do not need to provide custom context in order to access the store.
34-
React Redux exports the context instance it uses by default so that you can access the store by:
35-
36-
```js
37-
import { ReactReduxContext } from 'react-redux'
38-
39-
// in your connected component
40-
render() {
41-
return (
42-
<ReactReduxContext.Consumer>
43-
{({ store }) => {
44-
// do something with the store here
45-
}}
46-
</ReactReduxContext.Consumer>
47-
)
48-
}
49-
```
33+
5034

5135
### Example Usage
5236

5337
In the example below, the `<App />` component is our root-level component. This means it’s at the very top of our component hierarchy.
5438

55-
**Vanilla React Example**
5639

5740
```jsx
5841
import React from 'react'
@@ -72,29 +55,3 @@ ReactDOM.render(
7255
)
7356
```
7457

75-
**Usage with React Router**
76-
77-
```jsx
78-
import React from 'react'
79-
import ReactDOM from 'react-dom'
80-
import { Provider } from 'react-redux'
81-
import { Router, Route } from 'react-router-dom'
82-
83-
import { App } from './App'
84-
import { Foo } from './Foo'
85-
import { Bar } from './Bar'
86-
import createStore from './createReduxStore'
87-
88-
const store = createStore()
89-
90-
ReactDOM.render(
91-
<Provider store={store}>
92-
<Router history={history}>
93-
<Route exact path="/" component={App} />
94-
<Route path="/foo" component={Foo} />
95-
<Route path="/bar" component={Bar} />
96-
</Router>
97-
</Provider>,
98-
document.getElementById('root')
99-
)
100-
```

‎docs/api/batch.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ hide_title: true
1111
batch((fn: Function))
1212
```
1313

14+
*added in v7.0.0*
15+
1416
React's `unstable_batchedUpdates()` API allows any React updates in an event loop tick to be batched together into a single render pass. React already uses this internally for its own event handler callbacks. This API is actually part of the renderer packages like ReactDOM and React Native, not the React core itself.
1517

1618
Since React-Redux needs to work in both ReactDOM and React Native environments, we've taken care of importing this API from the correct renderer at build time for our own use. We also now re-export this function publicly ourselves, renamed to `batch()`. You can use it to ensure that multiple actions dispatched outside of React only result in a single render update, like this:

‎docs/api/connect-advanced.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ It does not modify the component class passed to it; instead, it _returns_ a new
1717
1818
Most applications will not need to use this, as the default behavior in `connect` is intended to work for most use cases.
1919
20-
> Note: `connectAdvanced` was added in version 5.0, and `connect` was reimplemented as a specific set of parameters to `connectAdvanced`.
20+
:::info
21+
22+
`connectAdvanced` was added in version 5.0, and `connect` was reimplemented as a specific set of parameters to `connectAdvanced`. However, [**`connectAdvanced` is now deprecated**](https://github.com/reduxjs/react-redux/issues/1236) and will eventually be removed in a future major version of React Redux.
23+
24+
:::
25+
2126
2227
## Arguments
2328

‎docs/api/connect.md

+10
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,13 @@ const makeMapState = (state) => {
577577
}
578578
export default connect(makeMapState)(SomeComponent)
579579
```
580+
581+
582+
## Legacy Version Docs
583+
584+
While the `connect` API has stayed almost entirely API-compatible between all of our major versions, there have been some small changes in options and behavior from version to version.
585+
586+
For details on the legacy 5.x and 6.x versions, please see these archived files in the React Redux repo:
587+
588+
- [5.x `connect` API reference](https://github.com/reduxjs/react-redux/blob/v7.2.2/website/versioned_docs/version-5.x/api/connect.md)
589+
- [6.x `connect` API reference](https://github.com/reduxjs/react-redux/blob/v7.2.2/website/versioned_docs/version-6.x/api/connect.md)

‎docs/api/hooks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ hide_title: true
77

88
# Hooks
99

10-
React's new ["hooks" APIs](https://reactjs.org/docs/hooks-intro.html) give function components the ability to use local component state, execute side effects, and more.
10+
React's new ["hooks" APIs](https://reactjs.org/docs/hooks-intro.html) give function components the ability to use local component state, execute side effects, and more. React also lets us write [custom hooks](https://reactjs.org/docs/hooks-custom.html), which let us extract reusable hooks to add our own behavior on top of React's built-in hooks.
1111

12-
React Redux now offers a set of hook APIs as an alternative to the existing `connect()` Higher Order Component. These APIs allow you to subscribe to the Redux store and dispatch actions, without having to wrap your components in `connect()`.
12+
React Redux includes its own custom hook APIs, which allow your React components to subscribe to the Redux store and dispatch actions.
1313

1414
:::tip
1515

‎docs/introduction/getting-started.md

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
id: getting-started
3+
title: Getting Started
4+
hide_title: true
5+
sidebar_label: Getting Started
6+
---
7+
8+
# Getting Started with React Redux
9+
10+
[React Redux](https://github.com/reduxjs/react-redux) is the official [React](https://reactjs.org/) UI bindings layer 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 state.
11+
12+
## Installation
13+
14+
React Redux 7.1+ requires **React 16.8.3 or later**, in order to make use of React Hooks.
15+
16+
### Using Create React App
17+
18+
The recommended way to start new apps with React Redux is by using the [official Redux+JS template](https://github.com/reduxjs/cra-template-redux) for [Create React App](https://github.com/facebook/create-react-app), which takes advantage of [Redux Toolkit](https://redux-toolkit.js.org/).
19+
20+
```sh
21+
npx create-react-app my-app --template redux
22+
```
23+
24+
### An Existing React App
25+
26+
To use React Redux with your React app, install it as a dependency:
27+
28+
```bash
29+
# If you use npm:
30+
npm install react-redux
31+
32+
# Or if you use Yarn:
33+
yarn add react-redux
34+
```
35+
36+
You'll also need to [install Redux](https://redux.js.org/introduction/installation) and [set up a Redux store](https://redux.js.org/recipes/configuring-your-store/) in your app.
37+
38+
If you are using TypeScript, the React Redux types are maintained separately in DefinitelyTyped. You'll need to install those as well:
39+
40+
```bash
41+
npm install @types/react-redux
42+
```
43+
44+
## `Provider`
45+
46+
React Redux includes a `<Provider />` component, which makes the Redux store available to the rest of your app:
47+
48+
```js
49+
import React from 'react'
50+
import ReactDOM from 'react-dom'
51+
52+
import { Provider } from 'react-redux'
53+
import store from './store'
54+
55+
import App from './App'
56+
57+
const rootElement = document.getElementById('root')
58+
ReactDOM.render(
59+
<Provider store={store}>
60+
<App />
61+
</Provider>,
62+
rootElement
63+
)
64+
```
65+
66+
## Hooks
67+
68+
React Redux provides a pair of custom React hooks that allow your React components to interact with the Redux store.
69+
70+
`useSelector` reads a value from the store state and subscribes to updates, while `useDispatch` returns the store's `dispatch` method to let you dispatch actions.
71+
72+
```js
73+
import React, { useState } from 'react'
74+
import { useSelector, useDispatch } from 'react-redux'
75+
import {
76+
decrement,
77+
increment,
78+
incrementByAmount,
79+
incrementAsync,
80+
selectCount
81+
} from './counterSlice'
82+
import styles from './Counter.module.css'
83+
84+
export function Counter() {
85+
const count = useSelector(selectCount)
86+
const dispatch = useDispatch()
87+
const [incrementAmount, setIncrementAmount] = useState('2')
88+
89+
return (
90+
<div>
91+
<div className={styles.row}>
92+
<button
93+
className={styles.button}
94+
aria-label="Increment value"
95+
onClick={() => dispatch(increment())}
96+
>
97+
+
98+
</button>
99+
<span className={styles.value}>{count}</span>
100+
<button
101+
className={styles.button}
102+
aria-label="Decrement value"
103+
onClick={() => dispatch(decrement())}
104+
>
105+
-
106+
</button>
107+
</div>
108+
{/* omit additional rendering output here */}
109+
</div>
110+
)
111+
}
112+
```
113+
114+
## Help and Discussion
115+
116+
The **[#redux channel](https://discord.gg/0ZcbPKXt5bZ6au5t)** of the **[Reactiflux Discord community](http://www.reactiflux.com)** is our official resource for all questions related to learning and using Redux. Reactiflux is a great place to hang out, ask questions, and learn - come join us!
117+
118+
You can also ask questions on [Stack Overflow](https://stackoverflow.com) using the **[#redux tag](https://stackoverflow.com/questions/tagged/redux)**.
119+
120+
## Docs Translations
121+
122+
- [Portuguese](https://fernandobelotto.github.io/react-redux)

‎docs/introduction/quick-start.md

-91
This file was deleted.

‎docs/troubleshooting.md

+3-58
Original file line numberDiff line numberDiff line change
@@ -7,74 +7,19 @@ hide_title: true
77

88
## Troubleshooting
99

10-
Make sure to check out [Troubleshooting Redux](https://redux.js.org/troubleshooting) first.
10+
The **[#redux channel](https://discord.gg/0ZcbPKXt5bZ6au5t)** of the **[Reactiflux Discord community](http://www.reactiflux.com)** is our official resource for all questions related to learning and using Redux. Reactiflux is a great place to hang out, ask questions, and learn - come join us!
1111

12-
### I'm getting the following alert: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
12+
You can also ask questions on [Stack Overflow](https://stackoverflow.com) using the **[#redux tag](https://stackoverflow.com/questions/tagged/redux)**.
1313

14-
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.
15-
16-
Update to the latest version of react-redux.
1714

1815
### My views aren’t updating!
1916

20-
See the link above.
2117
In short,
2218

2319
- Reducers should never mutate state, they must return new objects, or React Redux won’t see the updates.
24-
- 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.
25-
26-
### My views aren’t updating on route change with React Router 0.13
27-
28-
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 `<RouteHandler>` or the `Handler` provided by `Router.run`, pass the router state to it.
29-
30-
Root view:
31-
32-
```jsx
33-
Router.run(routes, Router.HistoryLocation, (Handler, routerState) => {
34-
// note "routerState" here
35-
ReactDOM.render(
36-
<Provider store={store}>
37-
{/* note "routerState" here */}
38-
<Handler routerState={routerState} />
39-
</Provider>,
40-
document.getElementById('root')
41-
)
42-
})
43-
```
44-
45-
Nested view:
46-
47-
```js
48-
render() {
49-
// Keep passing it down
50-
return <RouteHandler routerState={this.props.routerState} />
51-
}
52-
```
53-
54-
Conveniently, this gives your components access to the router state!
55-
You can also upgrade to React Router 1.0 which shouldn’t have this problem. (Let us know if it does!)
56-
57-
### My views aren’t updating when something changes outside of Redux
58-
59-
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.
60-
61-
> 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).
62-
63-
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.
20+
- Make sure you are actually _dispatching_ actions. For example, if you have an action creator like `addTodo`, just calling the imported `addTodo()` function by itself won't do anything because it just _returns_ an action, but does not _dispatch_ it. You either need to call `dispatch(addTodo())` (if using the hooks API) or `props.addTodo()` (if using `connect` + `mapDispatch`).
6421

65-
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()`:
66-
67-
```js
68-
function mapStateToProps(state) {
69-
return { todos: state.todos }
70-
}
71-
72-
export default connect(mapStateToProps, null, null, {
73-
pure: false,
74-
})(TodoApp)
75-
```
7622

77-
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.
7823

7924
### Could not find "store" in either the context or props
8025

‎docs/introduction/basic-tutorial.md ‎docs/tutorials/connect.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
---
2-
id: basic-tutorial
3-
title: Basic Tutorial
2+
id: connect
3+
title: "Tutorial: Connect API"
44
hide_title: true
5-
sidebar_label: Basic Tutorial
5+
sidebar_label:
66
---
77

8-
# Basic Tutorial
8+
# Tutorial: Using the `connect` API
9+
10+
:::tip
11+
12+
We now recommend using [the React-Redux hooks API as the default](../api/hooks.md). However, the `connect` API still works fine.
13+
14+
This tutorial also shows some older practices we no longer recommend, like separating Redux logic into folders by type. We've kept this tutorial as-is for completeness, but recommend reading through [the "Redux Essentials" tutorial](https://redux.js.org/tutorials/essentials/part-1-overview-concepts) and the [Redux Style Guide](https://redux.js.org/style-guide/style-guide) in the Redux docs for our current best practices.
15+
16+
:::
917

1018
To see how to use React Redux in practice, we’ll show a step-by-step example by creating a todo list app.
1119

‎docs/using-react-redux/accessing-store.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The [`useStore` hook](../api/hooks.md#useStore) returns the current store instan
3434

3535
Instead of using the default context instance from React Redux, you may supply your own custom context instance.
3636

37-
```js
37+
```jsx
3838
<Provider context={MyContext} store={store}>
3939
<App />
4040
</Provider>
@@ -75,7 +75,7 @@ The following runtime error occurs when React Redux does not find a store in the
7575
## Multiple Stores
7676

7777
[Redux was designed to use a single store](https://redux.js.org/api/store#a-note-for-flux-users).
78-
However, if you are in an unavoidable position of needing to use multiple stores, with v6 you may do so by providing (multiple) custom contexts.
78+
However, if you are in an unavoidable position of needing to use multiple stores, as of v6 you may do so by providing (multiple) custom contexts.
7979
This also provides a natural isolation of the stores as they live in separate context instances.
8080

8181
```js
@@ -118,17 +118,26 @@ compose(
118118
In rare cases, you may need to access the Redux store directly in your own components. This can be done by rendering
119119
the appropriate context consumer yourself, and accessing the `store` field out of the context value.
120120

121-
> **Note**: This is **_not_ considered part of the React Redux public API, and may break without notice**. We do recognize
122-
> that the community has use cases where this is necessary, and will try to make it possible for users to build additional
123-
> functionality on top of React Redux, but our specific use of context is considered an implementation detail.
124-
> If you have additional use cases that are not sufficiently covered by the current APIs, please file an issue to discuss
125-
> possible API improvements.
121+
:::caution
126122

127-
```js
123+
This is **_not_ considered part of the React Redux public API, and may break without notice**. We do recognize
124+
that the community has use cases where this is necessary, and will try to make it possible for users to build additional
125+
functionality on top of React Redux, but our specific use of context is considered an implementation detail.
126+
If you have additional use cases that are not sufficiently covered by the current APIs, please file an issue to discuss
127+
possible API improvements.
128+
129+
:::
130+
131+
```jsx
128132
import { ReactReduxContext } from 'react-redux'
129133

130-
// in your connected component
134+
// Somewhere inside of a <Provider>
131135
function MyConnectedComponent() {
136+
// Access the store via the `useContext` hook
137+
const {store} = useContext(ReactReduxContext)
138+
139+
// alternately, use the render props form of the context
140+
/*
132141
return (
133142
<ReactReduxContext.Consumer>
134143
{({ store }) => {
@@ -137,6 +146,7 @@ function MyConnectedComponent() {
137146
}}
138147
</ReactReduxContext.Consumer>
139148
)
149+
*/
140150
}
141151
```
142152

‎docs/using-react-redux/static-types.md ‎docs/using-react-redux/usage-with-typescript.md

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
---
2-
id: static-typing
3-
title: Static Typing
2+
id: usage-with-typescript
3+
title: Usage with TypeScript
44
hide_title: true
5-
sidebar_label: Static Typing
5+
sidebar_label: Usage with TypeScript
66
---
77

8-
# Static Typing
8+
# Usage with TypeScript
99

10-
React-Redux is currently written in plain JavaScript. However, it works well with static type systems such as TypeScript and Flow.
10+
React-Redux itself is currently written in plain JavaScript. However, it works well with static type systems such as TypeScript and Flow.
1111

12-
## TypeScript
12+
React-Redux doesn't ship with its own type definitions. If you are using TypeScript you should install the [`@types/react-redux` type definitions](https://npm.im/@types/react-redux) from NPM. In addition to typing the library functions, the types also export some helpers to make it easier to write typesafe interfaces between your Redux store and your React components.
1313

14-
React-Redux doesn't ship with its own type definitions. If you are using Typescript you should install the [`@types/react-redux` type definitions](https://npm.im/@types/react-redux) from npm. In addition to typing the library functions, the types also export some helpers to make it easier to write typesafe interfaces between your Redux store and your React components.
15-
16-
### Defining the Root State Type
14+
## Defining the Root State Type
1715

1816
Both `mapState` and `useSelector` depend on declaring the type of the complete Redux store state value. While this type could be written by hand, the easiest way to define it is to have TypeScript infer it based on what your root reducer function returns. This way, the type is automatically updated as the reducer functions are modified.
1917

@@ -29,7 +27,7 @@ export type RootState = ReturnType<typeof rootReducer>
2927
// {posts: PostsState, comments: CommentsState, users: UsersState}
3028
```
3129
32-
### Typing the `useSelector` hook
30+
## Typing the `useSelector` hook
3331
3432
When writing selector functions for use with `useSelector`, you should explicitly define the type of the `state` parameter. TS should be able to then infer the return type of the selector, which will be reused as the return type of the `useSelector` hook:
3533
@@ -63,7 +61,7 @@ import { useTypedSelector } from './reducer.ts'
6361
const isOn = useTypedSelector((state) => state.isOn)
6462
```
6563

66-
### Typing the `useDispatch` hook
64+
## Typing the `useDispatch` hook
6765

6866
By default, the return value of `useDispatch` is the standard `Dispatch` type defined by the Redux core types, so no declarations are needed:
6967

@@ -88,9 +86,9 @@ export type AppDispatch = typeof store.dispatch
8886
export const useAppDispatch = () => useDispatch<AppDispatch>() // Export a hook that can be reused to resolve types
8987
```
9088

91-
### Typing the `connect` higher order component
89+
## Typing the `connect` higher order component
9290

93-
#### Manually Typing `connect`
91+
### Manually Typing `connect`
9492

9593
The `connect` higher-order component is somewhat complex to type, because there are 3 sources of props: `mapStateToProps`, `mapDispatchToProps`, and props passed in from the parent component. Here's a full example of what it looks like to do that manually.
9694

@@ -153,7 +151,7 @@ type Props = StateProps & DispatchProps & OwnProps
153151
154152
However, inferring the type of `mapDispatch` this way will break if it is defined as an object and also refers to thunks.
155153
156-
#### Inferring The Connected Props Automatically
154+
### Inferring The Connected Props Automatically
157155
158156
`connect` consists of two functions that are called sequentially. The first function accepts `mapState` and `mapDispatch` as arguments, and returns a second function. The second function accepts the component to be wrapped, and returns a new wrapper component that passes down the props from `mapState` and `mapDispatch`. Normally, both functions are called together, like `connect(mapState, mapDispatch)(MyComponent)`.
159157
@@ -216,7 +214,7 @@ type PropsFromRedux = ConnectedProps<typeof connector>
216214
export default connector(MyComponent)
217215
```
218216

219-
### Recommendations
217+
## Recommendations
220218

221219
The hooks API is generally simpler to use with static types. **If you're looking for the easiest solution for using static types with React-Redux, use the hooks API.**
222220

@@ -226,7 +224,7 @@ If you're using `connect`, **we recommend using the `ConnectedProps<T>` approach
226224

227225
For additional information, see these additional resources:
228226

229-
- [Redux docs: Usage with TypeScript](https://redux.js.org/recipes/usage-with-typescript): Examples of how to declare types for actions, reducers, and the store
230-
- [Redux Toolkit docs: Advanced Tutorial](https://redux-toolkit.js.org/tutorials/advanced-tutorial): shows how to use RTK and the React-Redux hooks API with TypeScript
227+
- [Redux docs: Usage with TypeScript](https://redux.js.org/recipes/usage-with-typescript): Examples of how to use Redux Toolkit, the Redux core, and React Redux with TypeScript
228+
- [Redux Toolkit docs: TypeScript Quick start](https://redux-toolkit.js.org/tutorials/typescript): shows how to use RTK and the React-Redux hooks API with TypeScript
231229
- [React+TypeScript Cheatsheet](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet): a comprehensive guide to using React with TypeScript
232230
- [React + Redux in TypeScript Guide](https://github.com/piotrwitek/react-redux-typescript-guide): extensive information on patterns for using React and Redux with TypeScript

‎website/_redirects

+17
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,20 @@
44
/docs/using-react-redux/connect-dispatching-actions-with-mapdispatchtoprops /using-react-redux/connect-mapdispatch
55

66
/docs/* /:splat
7+
8+
# Renamed pages
9+
/introduction/quick-start /introduction/getting-started
10+
/next/introduction/quick-started /introduction/getting-started
11+
12+
/introduction/basic-tutorial /tutorials/connect
13+
/next/introduction/basic-tutorial /tutorials/connect
14+
15+
/using-react-redux/static-typing /using-react-redux/usage-with-typescript
16+
17+
# Drop versioned docs and redirect all legacy versions to the "current" version
18+
/next/* /:splat
19+
/5.x/* /:splat
20+
/6.x/* /:splat
21+
/7.0/* /:splat
22+
/7.1/* /:splat
23+
/versions /introduction/getting-started

‎website/docusaurus.config.js

+9-34
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const siteConfig = {
1616
{
1717
docs: {
1818
path: '../docs',
19-
sidebarPath: require.resolve('./sidebars.json'),
19+
sidebarPath: require.resolve('./sidebars.js'),
2020
routeBasePath: '/',
2121
include: [
22-
'{api,introduction,using-react-redux}/*.{md,mdx}',
22+
'{api,introduction,using-react-redux,tutorials}/*.{md,mdx}',
2323
'troubleshooting.md'
2424
] // no other way to exclude node_modules
2525
},
@@ -41,28 +41,11 @@ const siteConfig = {
4141
// Used for publishing and more
4242
projectName: 'react-redux',
4343
organizationName: 'reduxjs',
44-
// For top-level user or org sites, the organization is still the same.
45-
// e.g., for the https://JoelMarcey.github.io site, it would be set like...
46-
// organizationName: 'JoelMarcey'
4744

4845
// For no header links in the top nav bar -> headerLinks: [],
4946
/* path to images for header/footer */
5047
favicon: 'img/favicon/favicon.ico',
5148

52-
/* Custom fonts for website */
53-
/*
54-
fonts: {
55-
myFont: [
56-
"Times New Roman",
57-
"Serif"
58-
],
59-
myOtherFont: [
60-
"-apple-system",
61-
"system-ui"
62-
]
63-
},
64-
*/
65-
6649
// Add custom scripts here that would be placed in <script> tags.
6750
scripts: [
6851
'/scripts/sidebarScroll.js',
@@ -73,19 +56,11 @@ const siteConfig = {
7356
async: true
7457
}
7558
],
76-
7759
// You may provide arbitrary config keys to be used as needed by your
7860
// template. For example, if you need your repo's URL...
7961
customFields: {
8062
repoUrl: 'https://github.com/reduxjs/react-redux'
8163
},
82-
/**
83-
* Note:
84-
* This will generate a link on the versioned docs page for "pre-release versions"
85-
* Once next version is released, run "yarn run version 7.x", and docusaurus will add 7.x to stable version
86-
* After that, 7.x will no longer appear in "pre-release" versions and we should remove this line
87-
* More info: https://docusaurus.io/docs/en/versioning
88-
*/
8964
themeConfig: {
9065
metadatas: [{ name: 'twitter:card', content: 'summary' }],
9166
prism: {
@@ -100,13 +75,13 @@ const siteConfig = {
10075
},
10176
items: [
10277
{
103-
type: 'docsVersionDropdown',
104-
position: 'left'
105-
// Do not add the link active class when browsing docs.
78+
to: 'introduction/getting-started',
79+
label: 'Getting Started',
80+
position: 'right'
10681
},
10782
{
108-
to: 'introduction/quick-start',
109-
label: 'Quick Start',
83+
to: 'tutorials/connect',
84+
label: 'Tutorial',
11085
position: 'right'
11186
},
11287
{
@@ -122,7 +97,7 @@ const siteConfig = {
12297
className: 'github'
12398
},
12499
{
125-
href: '/introduction/quick-start#help-and-discussion',
100+
href: '/introduction/getting-started#help-and-discussion',
126101
label: 'Need help?',
127102
position: 'right'
128103
}
@@ -142,7 +117,7 @@ const siteConfig = {
142117
items: [
143118
{
144119
label: 'Introduction',
145-
to: 'introduction/quick-start'
120+
to: 'introduction/getting-started'
146121
},
147122
{
148123
label: 'Using React Redux',

‎website/sidebars.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
docs: {
3+
Introduction: [
4+
'introduction/getting-started',
5+
'introduction/why-use-react-redux'
6+
],
7+
Tutorials: ['tutorials/connect'],
8+
'Using React Redux': [
9+
'using-react-redux/usage-with-typescript',
10+
'using-react-redux/connect-mapstate',
11+
'using-react-redux/connect-mapdispatch',
12+
'using-react-redux/accessing-store'
13+
],
14+
'API Reference': [
15+
'api/provider',
16+
'api/hooks',
17+
'api/connect',
18+
'api/connect-advanced',
19+
'api/batch'
20+
],
21+
Guides: ['troubleshooting']
22+
}
23+
}

‎website/sidebars.json

-23
This file was deleted.

‎website/src/pages/_versions.js

-115
This file was deleted.

‎website/src/pages/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const features = [
2727
<p>
2828
<strong>Designed to work with React's component model</strong>. You
2929
define how to extract the values your component needs from Redux, and
30-
your component receives them as props.
30+
your component updates automatically as needed.
3131
</p>
3232
),
3333
image: <img src="img/noun_Check_1870817.svg" />,
@@ -37,9 +37,9 @@ const features = [
3737
{
3838
content: (
3939
<p>
40-
Creates wrapper components that{' '}
41-
<strong>manage the store interaction logic for you</strong>, so you
42-
don't have to write it yourself.
40+
Provides APIs that{' '}
41+
<strong>enable your components to interact with the Redux store</strong>
42+
, so you don't have to write that logic yourself.
4343
</p>
4444
),
4545
image: <img src="img/noun_Box_1664404.svg" />,
@@ -128,7 +128,7 @@ function Home() {
128128
'button button--secondary button--lg',
129129
styles.getStarted
130130
)}
131-
to={useBaseUrl('introduction/quick-start')}
131+
to={useBaseUrl('introduction/getting-started')}
132132
>
133133
Get Started
134134
</Link>

‎website/versions.json

-7
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.