1.0.0 • Published 8 years ago
react-side-channel
Licence
—
Version
1.0.0
Deps
1
Size
7 kB
Vulns
0
Weekly
0
React-Side-Channel
Render something aside, and reuse in main component tree
This is more or less about keeping the react render "tree" clean
API
- SideChannel with following props
initial- initial valuerender- something with input, and output.onChange- data update callbackchildren- in form of renderprop, to be givven output.
The goal of the library - put aside render, and pipe output to children, no matter how deep it is.
import {SideChannel} from 'react-side-channel';
<SideChannel
initial={0}
render={ ({input, output}) => <Value initial={input}>{output}</Value> }
>
({value, set}) => (
<div>{value}</div>
)}
</SideChannel>
Licence
MIT