Skip to content

Code splitting createSlice #2014

Answered by phryneas
Gambitboy asked this question in Q&A
Feb 9, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Honestly, if you take all actions out of that file and put them into one new file, your new file will be 10 lines shorter.

Generally, these reducers are just functions. You can declare them wherever you want, import them and just put them into the reducers object here. But at that point you will have to annotate them with types manually if you are using TypeScript.

Personally I'd rather extract some common code into functions that you call from those case reducers.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Gambitboy
Comment options

@phryneas
Comment options

@Gambitboy
Comment options

Answer selected by Gambitboy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants