0
Challenge · 20React Core
Lifting State Up
Coreused in ~90% of apps
When two components need the same data, the answer is almost always: move the state up.
Core idea. Put shared state in the closest common parent and pass it down as props (plus callbacks to change it).
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
Live demointeractive
Composer (child)
Feed (sibling child)
- Posts live in the PARENT
↑ play a little first, then dig in