Skip to content

TabView subviews redundant init #347

Answered by mbrandonw
rmncv asked this question in Q&A
Discussion options

You must be logged in to vote

If you are seeing too many views created/computed then it probably means your WithViewStore could be focused on a smaller set of state. For example, in the screenshot you posted you have WithViewStore(self.store), but then it seems that you aren't actually accessing any state from viewStore. That means the view will be recomputed any time actions are sent even though the state is never actually used to compute the body of the view.

So what you can do is .scope your store so that it holds only the pieces of state you care about. In this case you don't actually care about any state, and so you can use WithViewStore(self.store.stateless).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rmncv
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