DEV Community

Discussion on: Redux is Dead: Long Live Redux Toolkit

Collapse
 
markerikson profile image
Mark Erikson

Can you give an example of the before and after here, and show some RTK code that you feel is "less readable"?

the case of forcing ppl to use redux thunk as it's included in RTK package

This is a misunderstanding. Nothing about RTK forces you to use thunks. You can still add the saga middleware to the store, use that, and ignore thunks entirely if you want. RTK simply adds the thunk middleware to the store by default, and provides a createAsyncThunk API to simplify the common thunk usage patterns, but you are not at all "forced" to use thunks whatsoever.

Collapse
 
wplcz profile image
Wojciech Palacz

Actually it is as RTK includes ReduxThunk by default, copied from redux official page:
It includes several utility functions that simplify the most common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once without writing any action creators or action types by hand. It also includes the most widely used Redux addons, like Redux Thunk for async logic and Reselect for writing selector functions, so that you can use them right away.

RTK is less readable as it comes with Typescript, everything combined within one slice is less readable, apologies however I can't provide you with all code samples that made me feel its not clear :D