Futhermore, perhaps you don't need a big library like RxJS , flyd is perhaps a lighter alternative look at this
var update = flyd.stream(222); var App = function ({update}) { var [init, setInit] = React.useState(false); var [up, setUp] = React.useState(update()) if (!init) { setInit(true); update.map((s) => setUp(s)); } return ( <div> <h1>{up}</h1> </div> ); }; ReactDOM.render( <App update = {update} />, document.getElementById("app") ); // Test update(999)
You can test it here FlydStream
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Futhermore, perhaps you don't need a big library like RxJS , flyd is perhaps a lighter alternative look at this
You can test it here FlydStream