0

This is my redux/main/actions where I set my state.

export const setInfo = (data) => dispatch => {
  dispatch({
    type: t.SET_LOA,
    payload: data
  });
}
Manikandan
  • 21
  • 1
  • 1
  • 5

1 Answers1

1

Are you talking about something like this?

const dispatch = useDispatch()
// ...
dispatch(setInfo(data))
Free Me
  • 195
  • 2
  • 10
  • yeah exactly. but do we really need to dispatch once again though it has been already done in the export function. – Manikandan Jun 15 '22 at 17:49
  • Well this is the syntax of redux-thunk. I would recommend reading about this here: https://stackoverflow.com/a/34599594/11872581. It explains why this is written the way that it is. – Free Me Jun 17 '22 at 08:38