I see frameworks as Angular, Vue, React, the concept of reactivity .
I'm totally uninvolved in the subject, and from what little I know, the concept of reactive programming is basically the realization of asynchronous data flow. A variable in some of those frameworks that I quoted, ends up being reactive, because as you update in the controller / component, it changes in the DOM.
But how does this really work? I inserted a snippet from how I imagine an observable function, would it be something like reactivity?
var variavel = 1
function observable (){
setInterval(function(){
if(variavel == 1){
console.log('Do Nothing...')
} else console.log('Mudou!')
}, 1000)
}
function Usuario(){
setInterval(function(){
console.log('Usuario fez alguma ação que mudou a variavel')
variavel = 2
}, 5000)
}
Usuario()
observable()