React Redux Best way to update state after deleted Database row on Server


(X4kep) #1

I cant figure out how can update state from server after i delete something from db.
Example:
ACTION -> Delete user -> REDUCER -> REDUCER-REDUX ( After this i want to Call another action that will get all users so state updates )
ACTION -> getAllUsers -> REDUCER -> REDUCER-REDUX
Thanks,


(Jakob Lind) #2

You could have one action creator that does two ajax calls: deleteUser and getAllUsers. With Redux Thunk middleware you can dispatch many actions from the same reducer.


(Klequis) #3

The book Developing a Redux Edge has an effective way of doing this. The code is available on GitHub


(Balázs Sándor) #4

You do not need to reload all users when you delete one of them, you can remove it from the store with the reducer.

By the way I cant figure out your example.
Which step is the “ajax” call?
What is REDUCER-REDUX?