Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify API #2

Open
iofjuupasli opened this issue Feb 17, 2016 · 0 comments
Open

Simplify API #2

iofjuupasli opened this issue Feb 17, 2016 · 0 comments

Comments

@iofjuupasli
Copy link
Owner

const KefirReact = (observable, Component) => {
    return props => h(KefirReactComponent, {
        observable,
        render: values => h(Component, merge(props, values))
    });
}

class Test extends React.Component {
    render() {
        return h(KefirReact(stream, MyComponent));
    }
}

const Test = KefirReact(stream, MyComponent);

ReactDOM.render(
    h(KefirReact(stream, MyComponent)),
    $('#app')
);

And export both KefirReact and KefirReactComponent. The second can be used when observable depends on props.

But there is a problem with observable - it should be KefirObservable<props>, and in most cases it will be combined object of Observables. But it still not implemented in Kefir: https://github.com/rpominov/kefir/issues/143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant