Update React with database being updated every second

Hey All,

I have a python script that updates a Mongo database every second. I need Meteor + React to update a component every time the data changes. The way i have things set up right now gets one value and stays static until you refresh the page, at which point it updates with a new static value.

Is there a way to get it to update when the data updates on its own, or do I need to setup some sort of setInterval() function in Meteor somewhere to get the data every so often?

Reactive updates are a standard part of Meteor. You’ll need a publication to publish a cursor containing the data that you wish to be sent to the client. Then create a component that is wrapped in a withTracker HOC and use it to display your data. It’s that simple.


Yep, withTracker was the way to go.