Best way to subscribe to typed events ReasonML that originate in Javascript?


#1

I want to have event listeners or reactive streams in ReasonML, where I can push typed things into them from javascript.

For example:

  • We have a list of operations in javascript
  • We append to that list regularly
  • I want various ReasonReact components to subscribe to and process every new operation

Is there a best practice for this?


#2

On the ReasonReact side, you can use the subscription helper: https://reasonml.github.io/reason-react/docs/en/subscriptions-helper.html

They’re lightweight, get the job done, and easy to move away from if they’re not suitable.