From 78d2f5e6880936063184427fdb235d34d4be8ba1 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Fri, 24 Nov 2023 19:37:40 -0500 Subject: [PATCH] Nuke most "ES2015" references --- docs/api/combineReducers.md | 2 +- docs/faq/Actions.md | 2 +- docs/faq/General.md | 8 +- docs/faq/ImmutableData.md | 4 +- docs/introduction/GettingStarted.md | 116 +++++++++--------- docs/style-guide/style-guide.md | 2 +- .../part-6-performance-normalization.md | 2 +- .../part-3-state-actions-reducers.md | 2 +- .../fundamentals/part-8-modern-redux.md | 2 +- .../history-and-design/PriorArt.md | 2 +- docs/usage/ServerRendering.md | 2 +- docs/usage/side-effects-approaches.mdx | 2 +- .../BasicReducerStructure.md | 2 +- .../structuring-reducers/InitializingState.md | 8 +- .../UsingCombineReducers.md | 8 +- src/bindActionCreators.ts | 2 +- src/combineReducers.ts | 2 +- 17 files changed, 88 insertions(+), 80 deletions(-) diff --git a/docs/api/combineReducers.md b/docs/api/combineReducers.md index 929193b5f08..c2a432cdc3f 100644 --- a/docs/api/combineReducers.md +++ b/docs/api/combineReducers.md @@ -80,7 +80,7 @@ Any reducer passed to `combineReducers` must satisfy these rules: - It must never return `undefined`. It is too easy to do this by mistake via an early `return` statement, so `combineReducers` throws if you do that instead of letting the error manifest itself somewhere else. -- If the `state` given to it is `undefined`, it must return the initial state for this specific reducer. According to the previous rule, the initial state must not be `undefined` either. It is handy to specify it with ES2015 optional arguments syntax, but you can also explicitly check the first argument for being `undefined`. +- If the `state` given to it is `undefined`, it must return the initial state for this specific reducer. According to the previous rule, the initial state must not be `undefined` either. It is handy to specify it with optional arguments syntax, but you can also explicitly check the first argument for being `undefined`. While `combineReducers` attempts to check that your reducers conform to some of these rules, you should remember them, and do your best to follow them. `combineReducers` will check your reducers by passing `undefined` to them; this is done even if you specify initial state to `Redux.createStore(combineReducers(...), initialState)`. Therefore, you **must** ensure your reducers work properly when receiving `undefined` as state, even if you never intend for them to actually receive `undefined` in your own code. diff --git a/docs/faq/Actions.md b/docs/faq/Actions.md index 7768f70b889..b47691c628e 100644 --- a/docs/faq/Actions.md +++ b/docs/faq/Actions.md @@ -114,7 +114,7 @@ There are [many async/side effect middlewares available](https://github.com/mark As a general rule of thumb: - Thunks are best for complex synchronous logic (especially code that needs access to the entire Redux store state), and simple async logic (like basic AJAX calls). With the use of `async/await`, it can be reasonable to use thunks for some more complex promise-based logic as well. -- Sagas are best for complex async logic and decoupled "background thread"-type behavior, especially if you need to listen to dispatched actions (which is something that can't be done with thunks). They require familiarity with ES2015 generator functions and `redux-saga`'s "effects" operators. +- Sagas are best for complex async logic and decoupled "background thread"-type behavior, especially if you need to listen to dispatched actions (which is something that can't be done with thunks). They require familiarity with generator functions and `redux-saga`'s "effects" operators. - Observables solve the same problems as sagas, but rely on RxJS to implement async behavior. They require familiarity with the RxJS API. We recommend that most Redux users should start with thunks, and then add an additional side effect library like sagas or observables later if their app really requires handling for more complex async logic. diff --git a/docs/faq/General.md b/docs/faq/General.md index 744247b168a..5477008ac04 100644 --- a/docs/faq/General.md +++ b/docs/faq/General.md @@ -104,7 +104,13 @@ Redux can be used as a data store for any UI layer. The most common usage is wit ## Do I need to have a particular build tool to use Redux? -Redux is originally written in ES2015 and transpiled for production into ES5 with Webpack and Babel. You should be able to use it regardless of your JavaScript build process. Redux also offers a UMD build that can be used directly without any build process at all. The [counter-vanilla](https://github.com/reduxjs/redux/tree/master/examples/counter-vanilla) example demonstrates basic ES5 usage with Redux included as a `