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