Skip to content

Simplify API #2

@iofjuupasli

Description

@iofjuupasli
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions