WithViewStore Causes Subview to Re-render on Parent State Update #3706
-
Hi guys, I just wanted to ask for your opinion—are there any best practices for using WithViewStore to prevent unnecessary re-renders in other split components? given my code below:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
"My alternative approach is to split into another view by not observing the parent view with WithViewStore. However, I'm not sure if this is the best approach. Could there be a better way?"
|
Beta Was this translation helpful? Give feedback.
-
@WHuangz88 |
Beta Was this translation helpful? Give feedback.
@WHuangz88
ViewStore
andWithViewStore
were deprecated 2 years ago with the introduction of back-ported observation tools, and will be removed in TCA 2.0. Can you use@ObservableState
, instead? This should automatically minimize the number of re-renders based on what state is accessed.