Compound Components

<Pagination count={10}​ current={3} />

Requests

  • add first & last items

  • group next & prev

  • add entries info

<Pagination
  count={10}
  current={3}
  showFirstAndLast={true}
  displayInfo="Show %s of %s"
  showPrevAndNextTogether={true}
/>

<Pagination count={10} current={3}>
   <Pagination.Last />
   <Pagination.First />
   <Pagination.Current />
   <Pagination.Prev />
   <Pagination.Next />
</Pagination>

How to think about them

  • Multiple components that manage/share a single state
  • Decouple rendering from logic
  • Allow the user to control rendering
  • DSL
https://youtu.be/hEGg-3pIHlE
egghead.io - react-write-compound-components

Thanks!

Made with Slides.com