Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 707 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 707 Bytes

Minimal context examples

# install
pnpm install
# OR
npm install

# run
vite

This repo shows 4 minimal examples (button click -> display count) of how state can be shared across react components. Each branch holds a different method:

  • main: using context, with as much as possible abstracted to the context.
  • minimal-context: using context, with as little as possible abstracted to the context.
  • prop-drilling: with props passed down through intermediary components.
  • prop-sharing-composition: with props passed directly to sub-child components.

The component structure in each case is:

  • App
    • Parent
      • Button
    • Parent
      • Child