The on function #3104
Answered
by
markostanimirovic
lukhomdingi
asked this question in
Q&A
-
|
Hello, Could you provide a proper way of using the on function with the following syntax: |
Beta Was this translation helpful? Give feedback.
Answered by
markostanimirovic
Aug 2, 2021
Replies: 1 comment
-
|
However, if you want to use export const onLoginSuccess = on<fromAuth.State, [typeof AuthApiActions.loginSuccess]>(
AuthApiActions.loginSuccess,
(state, { user }) => ({ ...state, user })
); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
markostanimirovic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lukhomdingi
onfunction is intended for use within thecreateReducerfunction. Then the type of action creators will be automatically inferred.However, if you want to use
onfunction separately, you can manually declare the type of action creator array: