createSlice and createReducer are using internally Immer ( package handling immutable data structure. ) : this is why it we can provide the updated value like so.
the toolkit is really nice however this is unfortunate that such official opinionated tool implies confusing habits ( such as re-assigning the value straight away affected ) whereas the the fundamental principal of the mature react library was enforcing the habit to not mutate directly the value pre and post hooks.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
After practicing a bit I had my answer:
the toolkit is really nice however this is unfortunate that such official opinionated tool implies confusing habits ( such as re-assigning the value straight away affected ) whereas the the fundamental principal of the mature react library was enforcing the habit to not mutate directly the value pre and post hooks.