react-rxk
v7.0.0
Published
Higher order component to make any component accept RxJS observables as props
Downloads
21
Readme
react-rx
Higher order component to make any component accept RxJS observables and promises as props
Create a component
interface MyProps {
time: number;
}
class MyComp extends React.Component<MyProps> {
render() {
return (
<div>
<label>Time is: </label>{this.props.time}
</div>)
}
}
Use the Rx
to pass observables as props
class AnotherComp extends React.Component {
timer = rx.timer(1000);
render() {
return <Rx
render={MyComp}
props={{
//time property accepts number | Observable<number> | Promise<number>
time: this.timer
}}
/>;
}
}