While analyzing an existing codebase, I came across a reducer function called reviewReducer
that was created without using the syntax of the createReducer
function.
The reviewReducer
function in the code snippet below behaves like a typical reducer - it takes the same number and type of arguments, and responds to actions (confirmed through debugging).
However, after searching through the create-reducer.ts
file and the entire application, I couldn't find the createReducer
function anywhere. This raises the question: Is it possible to create a reducer without using createReducer
?
create-reducer.ts
import { Action } from 'rxjs/scheduler/Action';
export function reviewReducer(state: State<Any>, action: ReviewActionList{
return {
...state,
result: true
}
}