New methods in callbacks and improved types
Now, in the callbacks you have an access to redux dispatch and getState and signalr invoke methods.
const callbacks = withCallbacks()
.add('ReceiveMessage', (msg: string) => (dispatch) => {
dispatch(setText(msg));
})
.add('ReceiveRandomNumber', (num: number) => (dispatch, getState, invoke) => {
const { example } = getState();
dispatch(setRandomNumber(num));
invoke('SendMessage', txt + example.text)
})
Use your custom Dispatch and RootState types in withCallbacks, this way you will have correct typings for dispatch and getState methods in your callbacks
const callbacks = withCallbacks<Dispatch, RootState>()
.add('CallbackName', () => (dispatch, getState, invoke) => { }