Replies: 2 comments 5 replies
-
I think you should start with elaborating what you are trying to achieve and why you're not using |
Beta Was this translation helpful? Give feedback.
1 reply
-
Your sandbox doesn't work for me. But I'd use either observables for your
local component state as well to leverage the same optimizations offered by
MobX, or use `<Observer>` sections instead of `observer`. Managing your own
autorun to optimise render should really not be needed.
…On Thu, Apr 15, 2021 at 1:11 PM Shrroy ***@***.***> wrote:
Hi Mweststrate, glad you replied! I'm trying to prevent the components
from unnecessary updates. As you can see in my example on Codesandbox in
the ChildOne component I'm updating a specific state in the store which
I'm not using in other components and that action causes the other
components to get updated as well. I solved that in the ChildThree
component by using shouldComponentUpdate method and instead of using observer
I used autorunbecause I couldn't useshouldComponentUpdatemethod while the
component is wrapped withobserver`
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2896 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBEPFIMUODWRXHM6DMDTI3JXJANCNFSM427KEVCQ>
.
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm wondering about my approach if this how I supposed to prevent the other components from getting an update when it's not necessary.
Please take a look at Stackblitz below
https://stackblitz.com/edit/react-jimjgz
Beta Was this translation helpful? Give feedback.
All reactions