useInjectReducer()
function useInjectReducer(options: {
key: string;
reducer: Reducer;
}): boolean;
A react hook that dynamically injects a reducer when the hook is run
Parameters
options
key
string
The key to inject the reducer under
reducer
Reducer
The reducer that will be injected
Returns
boolean
flag indicating whether or not the reducer has finished injecting
Example
function BooksManager() {
useInjectReducer({ key: "books", reducer: booksReducer })
return null;
}