The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Pass observable data through props in MobX

Pass observable data through props in MobX

3:34
This lesson explains how you can build larger trees of react component and how they are managed efficiently by MobX. You will learn how to pass observable data structures around in props and how the Devtools can be used to analyze the performance of your UI.
Watch this lesson now
Avatar
egghead.io

This lesson explains how you can build larger trees of react component and how they are managed efficiently by MobX. You will learn how to pass observable data structures around in props and how the Devtools can be used to analyze the performance of your UI.

Avatar
Liad

After the separation - why wasn't the observer on the first function enough to trigger the a view change when a temperature was clicked?
Is the first function now observes only added/removed temperatures and the second one observes actual temperature changes?
What will happen if a change needs to re-render both a parent component and a child component?
Thanks :)

Avatar
Michel Weststrate

observer only observers data that is used in its own render function, but not data that is used in child components. So the first function reacts to any change that happens to the temperature collection because it loops it. Not just addition / removal but also if an element is replaced at a certain index. And the second indeed reacts to changes to the rendered attributes of the temperature object. If both the collection and a temperature are changed by the same action, both components will re-rendered. Other Temperature components with an unchanged temperature object won't re-render though.

In reply to Liad
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?