Is there an equivalent of Tracker.autorun() in the node world?

#1

Is there an equivalent of Tracker.autorun() in the node world to be used in a react app on client with express framework?

#2

That question is a bit broad and ambigous. Express is a backend webapp framework, react is a client ui layer and node is an server runtime :wink:

so what is exactly your question?

#3

@ macrozone, So, I want to observe some variable and when the variable changes I want to call a function. You can think of something like watching for events and writing a listener. But in this case I want to watch for change in a variable value and call a function when the value changes.

#4

This pattern is commonly refered as reactive programming and some framework use it to react on state change. So the question is still too broad, are you looking for a framework that uses this pattern or are you having a specifc problem that you want to solve with that pattern?

#5

RxJS observables are close, though they need a bit more boilerplate (they’re less magic)

Vue also has it’s own reactivity system, which is part of the reason why it’s been a little harder to get Meteor Vue to work as neatly as React

Alternatively, Tracker is simple enough that you can take it out of Meteor and use it on it’s own

1 Like