Skip to content

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

License

Notifications You must be signed in to change notification settings

iofjuupasli/kefir-react

Repository files navigation

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$

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published