Shopify
Shopify logoShopify · Feature trail

Redux Toolkit Migration for State Management

1 post · Mar 2023

What this trail covers

Shopify's Retail Point of Sale app migrated from Vanilla Redux to Redux Toolkit (RTK) to reduce boilerplate, improve code readability, and streamline state management. The migration adopted a balanced approach, reusing existing logic while refactoring reducers and thunks to leverage RTK's features like immutable syntax and generated action creators. A hybrid approach was used for asynchronous logic due to GraphQL limitations with RTK Query, utilizing createAsyncThunk with ThunkAPI. Key learnings include the importance of explicit typing for hooks and the need for `unwrap()` on dispatch calls.

All Shopify trails