3 ms·
It's quite simple to handle that situation with jQuery and modules. If many parts of you code need to make a change to the DOM in the same place, you wrap the D
by bigmanwalter 10y ago
It's quite simple to handle that situation with jQuery and modules. If many parts of you code need to make a change to the DOM in the same place, you wrap the DOM changing in a module.
var widget = require('./widget');
widget.foo('bar');
And the widget handles the jQuery'ing for you.
module.exports = {
foo: function(s) { $('.widget').text(s) }
}
- dmitriid 10y agoOnly: - it breaks immediately if there is more than one '.widget' on the page - your app will get out-of-sync DOM updates because different parts will flush changes to the DOM at different times (React is DOM = f(state, time), so if multiple changes happen in f, they all be flushed to DOM in one go)