kefir-react

5.0.0-rc.2 • Public • Published

kefir-react

React wrapper component for linking Kefir.js observables as props value

Usage example

import { KefirReact } from 'kefir-react';

const myProperty = Kefir.fromPoll(1, () => new Date()})
    .toProperty(() => new Date());

class App extends React.Component {
    render() {
        return this.props.myValue;
    }
}

const AppWrapped = KefirReact(
    myProperty.map(myValue => { myValue }),
    App
);

class Main extends React.Component {
    render() {
        return React.createElement(AppWrapped);
    }
}

API

Exports KefirReact factory and KefirReactComponent react component

KefirReact

(props$, ComponentClass, [LoaderComponentClass]) -> WrappedComponentClass

So in props of instantiated ComponentClass there will be values from props$

LoaderComponentClass is optional. It'll be displayed until first value in props$.

Use kefir-combine-object to create props$

Readme

Keywords

Package Sidebar

Install

npm i kefir-react

Weekly Downloads

1

Version

5.0.0-rc.2

License

MIT

Last publish

Collaborators

  • iofjuupasli