January 21, 2019

268 words 2 mins read

renatorib/react-powerplug

renatorib/react-powerplug

:electric_plug: Renderless Containers

repo name renatorib/react-powerplug
repo link https://github.com/renatorib/react-powerplug
homepage http://rena.to/react-powerplug
language JavaScript
size (curr.) 1254 kB
stars (curr.) 2673
created 2017-09-11
license MIT License

React PowerPlug is a set of pluggable renderless components and helpers that provides different types of state and logic utilities that you can use with your dumb components. It creates state and passes down the logic to the children, so you can handle your data. Read about the Render Props pattern.

Highlights

  • :ok_hand: Dependency free
  • :electric_plug: Plug and play
  • :crystal_ball: Tree shaking friendly (ESM, no side effects)
  • :package: Super tiny (~3kb)
  • :books: Well documented
  • :beers: Bunch of awesome utilities
import { State, Toggle } from 'react-powerplug'
import { Pagination, Tabs, Checkbox } from './MyDumbComponents'

<State initial={{ offset: 0, limit: 10, totalCount: 200 }}>
  {({ state, setState }) => (
    <Pagination {...state} onChange={(offset) => setState({ offset })} />
  )}
</State>

<Toggle initial={true}>
  {({ on, toggle }) => (
    <Checkbox checked={on} onChange={toggle} />
  )}
</Toggle>

// You can also use a `render` prop instead

<Toggle
  initial={false}
  render={({ on, toggle }) => (
    <Checkbox checked={on} onChange={toggle} />
  )}
/>

Guide & Documentation

http://rena.to/react-powerplug/



Install

Node Module

yarn add react-powerplug
npm i react-powerplug

UMD

<script src="https://unpkg.com/react-powerplug/dist/react-powerplug.min.js"></script>

exposed as ReactPowerPlug

Contributors

Thanks goes to these wonderful people (emoji key):

Renato RibeiroπŸ’» 🎨 πŸ“– ⚠️ Bogdan ChadkinπŸ’» πŸ“– ⚠️ πŸš‡ Travis ArnoldπŸ’» πŸ“– πŸ› Max GraeyπŸ’» Mateusz BurzyΕ„skiπŸ› Andy EdwardsπŸ’» Andrea VaniniπŸ›
Ivan StarkovπŸ› Sean RobertsπŸ“– Braden KelleyπŸ›

This project follows the all-contributors specification. Contributions of any kind welcome!

Contribute

You can help improving this project sending PRs and helping with issues.
Also you can ping me at Twitter

comments powered by Disqus