renatorib / react-powerplug

:electric_plug: [Unmaintained] Renderless Containers

Home Page:https://renatorib.github.io/react-powerplug

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React PowerPlug

npm stars tweet


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

  • ๐Ÿ‘Œ Dependency free
  • ๐Ÿ”Œ Plug and play
  • ๐Ÿ”ฎ Tree shaking friendly (ESM, no side effects)
  • ๐Ÿ“ฆ Super tiny (~3kb)
  • ๐Ÿ“š Well documented
  • ๐Ÿป Bunch of awesome utilities
See quick examples
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/


Watch 'Rapid Prototyping with React PowerPlug' by Andrew Del Prete on egghead.io


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

About

:electric_plug: [Unmaintained] Renderless Containers

https://renatorib.github.io/react-powerplug

License:MIT License


Languages

Language:JavaScript 89.1%Language:TypeScript 10.9%