| applyMiddleware.ts |
Creates a store enhancer that applies middleware to the dispatch method
of the Redux store. This is handy for a variety of tasks, such as expressing
asynchronous actions in a concise manner, or logging every action payload.
See `redux-thunk` package as an example of the Redux middleware.
Because middleware is potentially asynchronous, this should be the first
store enhancer in the composition chain.
Note that each middleware will be given the `dispatch` and `getState` functions
as named arguments.
@param middlewares The middleware chain to be applied.
@returns A store enhancer applying the middleware.
@template Ext Dispatch signature added by a middleware.
@template S The type of the state supported by a middleware.
|
3071 |
- |
| bindActionCreators.ts |
Turns an object whose values are action creators, into an object with the
same keys, but with every function wrapped into a `dispatch` call so they
may be invoked directly. This is just a convenience method, as you can call
`store.dispatch(MyActionCreators.doSomething())` yourself just fine.
For convenience, you can also pass an action creator as the first argument,
and get a dispatch wrapped function in return.
@param actionCreators An object whose values are action
creator functions. One handy way to obtain it is to use `import * as`
syntax. You may also pass a single function.
@param dispatch The `dispatch` function available on your Redux
store.
@returns The object mimicking the original object, but with
every action creator wrapped into the `dispatch` call. If you passed a
function as `actionCreators`, the return value will also be a single
function.
|
2758 |
- |
| combineReducers.ts |
" ` +
`namespace. They are considered private. Instead, you must return the ` +
`current state for any unknown actions, unless it is undefined, ` +
`in which case you must return the initial state, regardless of the ` +
`action type. The initial state may not be undefined, but can be null.`
)
}
})
}
/**
Turns an object whose values are different reducer functions, into a single
reducer function. It will call every child reducer, and gather their results
into a single state object, whose keys correspond to the keys of the passed
reducer functions.
@template S Combined state object type.
@param reducers An object whose values correspond to different reducer
functions that need to be combined into one. One handy way to obtain it
is to use `import * as reducers` syntax. The reducers may never
return undefined for any action. Instead, they should return their
initial state if the state passed to them was undefined, and the current
state for any unrecognized action.
@returns A reducer function that invokes every reducer inside the passed
object, and builds a state object with the same shape.
|
6905 |
- |
| compose.ts |
Composes single-argument functions from right to left. The rightmost
function can take multiple arguments as it provides the signature for the
resulting composite function.
@param funcs The functions to compose.
@returns A function obtained by composing the argument functions from right
to left. For example, `compose(f, g, h)` is identical to doing
`(...args) => f(g(h(...args)))`.
|
1564 |
- |
| createStore.ts |
@deprecated
**We recommend using the `configureStore` method
of the `@reduxjs/toolkit` package**, which replaces `createStore`.
Redux Toolkit is our recommended approach for writing Redux logic today,
including store setup, reducers, data fetching, and more.
**For more details, please read this Redux docs page:**
**https://redux.js.org/introduction/why-rtk-is-redux-today**
`configureStore` from Redux Toolkit is an improved version of `createStore` that
simplifies setup and helps avoid common bugs.
You should not be using the `redux` core package by itself today, except for learning purposes.
The `createStore` method from the core `redux` package will not be removed, but we encourage
all users to migrate to using Redux Toolkit for all Redux code.
If you want to use `createStore` without this visual deprecation warning, use
the `legacy_createStore` import instead:
`import { legacy_createStore as createStore} from 'redux'`
|
17536 |
- |
| index.ts |
|
1243 |
- |
| types |
|
|
- |
| utils |
|
|
- |