Transition to another route on successful async redux action If you don’t want to use a more complete solution like Redux Router, you can use Redux History Transitions which lets you write code like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | export function login() { return { type: LOGGED_IN, payload: { userId: 123 } meta: { transition: (state, action) => ({ path: `/logged-in/${action.payload.userId}`, query: { some: 'queryParam' }, state: { some: 'state' } }) } }; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.