Deep Dive into Redux Toolkit with React - Complete Guide
Why Stack Overflow recommends it
Stack Overflow users link it when answering or asking about Redux Toolkit usage, especially createSlice patterns, typed payload actions and why to move from plain Redux.
Recommended by 2 people across 2 different months, 2021 to 2021.
What it is
A roughly 3.3 hour walkthrough of Redux Toolkit by Justin Kim. It covers the packages bundled in RTK, Immer and immutable update patterns, and the main RTK functions, then builds the same React app twice, once with classic Redux and once with Redux Toolkit, to compare them.
What people said
Recommends Tom Bombadil · 2021-04 · Stack Overflow · on “What is the best practice for using Redux to handle full async services?”
@Mike is right, toolkit is amazing. Checkout [this video] incase you want to learn toolkit and know more about the advantages it has to offer over redux.
Recommends Fotios Tsakiris · 2021-11 · Stack Overflow · on “How to pass in redux toolkit more that one arguments in an action?”
I could not find anything but a segment (1:41') in Justin's video here [this video] So this is how it's done: authenticate: (state, { payload }: PayloadAction<{ token: string; userId: string; expiryTime: number; userEmail: string }>) => { state.token = payload.token state.userId = payload.userId state.expiryTime = payload.expiryTime state.email = payload.userEmail state.triedAutoLogin = true }, Note: above the action is being destructured. So we do not have to do action.payload.token Thanks
Cites Athena Wisdom · 2021-06 · Stack Overflow · on “Using `null as string | null` in Typescript gives `Parsing error: Unexpected token, expected ","`”
I am following a React Toolkit tutorial that uses Typescript, and came across the use of initialState: null as string | null, in the example code provided [LINK] and explained at this part of the video [this video] : const selectedTodoSlice = createSlice({ name: "selectedTodo", initialState: null as string | null, reducers: { select: (state, { payload }: PayloadAction<{ id: string }>) => payload.id } }); However, when I run my code on my system containing the same block, the JS console gives the error index.js:1 src/redux-toolkit.ts Line 76:22: Parsing error: Unexpected token, expected "," 74 | const selectedTodoSlice = createSlice({ 75 | name: "selectedTodo", > 76 | initialState: null as string