Closed sompylasar closed 7 years ago
The state variable came from nowhere.
state
Using this library, the above is exactly equivalent to the following code: import { reducerWithInitialState } from "typescript-fsa-reducers"; const reducer = reducerWithInitialState(INITIAL_STATE) .case(setName, (action, name) => ({ ...state, name })) .case(addBalance, (action, amount) => ({ ...state, balance: state.balance + amount, })) .case(setIsFrozen, (action, isFrozen) => ({ ...state, isFrozen }));
Using this library, the above is exactly equivalent to the following code:
import { reducerWithInitialState } from "typescript-fsa-reducers"; const reducer = reducerWithInitialState(INITIAL_STATE) .case(setName, (action, name) => ({ ...state, name })) .case(addBalance, (action, amount) => ({ ...state, balance: state.balance + amount, })) .case(setIsFrozen, (action, isFrozen) => ({ ...state, isFrozen }));
You're absolutely right, thank you very much for the PR!
The
state
variable came from nowhere.