learn-co-curriculum / react-hooks-information-flow-code-along

Other
13 stars 3.32k forks source link

Maybe Conclusion can highlight opportunity to pass child values to parents via arguments to callbacks #5

Closed brigj1 closed 2 years ago

brigj1 commented 2 years ago

Canvas Link

https://learning.flatironschool.com/courses/5186/assignments/180088?module_item_id=397501

Concern

This statement in the conclusion is fine: For information to propagate up the component tree, we must invoke callbacks that were passed from parents to children as props.

However, you might extend it to emphasize the ability to pass child information to parents as arguments for the callbacks we are invoking: onChangeColor(newColor);

This was kind of an "Aha" moment for me.

Additional Context

No response

Suggested Changes

Maybe extend this statement: For information to propagate up the component tree, we must invoke callbacks that were passed from parents to children as props.

to something like this: For information to propagate up the component tree, we must invoke callbacks that were passed from parents to children as props. In the process, we can pass values of child variables as arguments when invoking those callbacks. (Shades of passing props from parents!)