react-dataful
v0.0.8
Published
HOC for building react data flow model.
Downloads
9
Readme
react-dataful
This is still a module on experiment.
Usage
import React from 'react';
import dataful from 'react-dataful';
const MyForm = ({ data, children }) =>
(<Form>{children}</Form>);
const EmailInput = ({ data, update }) => (
<input
type="email"
value={data}
onChange={e => update({ $set: e.target.value })}
/>
);
const DatafulEmailInput = dataful({ editable: true })(EmailInput);
const MyDatafulForm = dataful({ editable: true })(MyForm)
ReactDOM.render(
<MyDatafulForm
data={{ email: '[email protected]' }}
onChange={data => console.log('Data changed:', data)}
/>
<EmailInput scope={['email']} />
</MyDatafulForm>
);