react-powerplug

:electric_plug: Renderless Containers

Github星跟踪图

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):

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

主要指标

概览
名称与所有者renatorib/react-powerplug
主编程语言JavaScript
编程语言JavaScript (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2017-09-11 03:04:18
推送于2023-01-25 23:06:21
最后一次提交2022-09-12 22:46:16
发布数19
最新版本名称v1.0.0 (发布于 2018-11-06 20:35:08)
第一版名称v0.0.1 (发布于 2017-09-11 00:12:18)
用户参与
星数2.7k
关注者数26
派生数100
提交数198
已启用问题?
问题数61
打开的问题数9
拉请求数108
打开的拉请求数3
关闭的拉请求数48
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?