applyToRoot(middleware)
A higher-order middleware that ensures the provided middleware is only applied to the root store.
Arguments
middleware
(Function): Function that conforms to the Redux middleware API or Redux Subspaces middleware API
Returns
(Function): A Redux Subspace middleware that applies the middleware to the root store only.
Examples
import { createStore } from 'redux'
import { applyMiddleware, applyToRoot } from 'redux-subspace'
import { reducer, middleware } from 'somewhere'
const store = createStore(reducer, applyMiddleware(applyToRoot(middleware)))