Backbone.js and DOM manipulation

I am very new to the Javascript MVC framework and ask a question related to Backbone.js. They say that Backbone.js is very useful when there are a lot of manipulations with the DOM. Could you give a practical example of the same. How, how can using backbone.js help make the code cleaner if DOM manipulation / HTML for presentation is separate? How can it be used for general functions? Any other practical examples of using Backbone.js are also useful.

I already went through tutorials at http://documentcloud.github.com/backbone/ but could not find some basic examples.

Thanks.

+4
source share
2 answers

Welcome to the wonderful world of MVVM! If you are new to this, I would recommend starting with Knockout JS - they have good tutorials at http://learn.knockoutjs.com/ that describe the benefits of the approach. I found that Knockout is much easier to work than Backbone.

-6
source

From document

Only the tough baseline dependency is Underscore.js (> 1.3.1). To preserve RESTful history support using Backbone.Router and DOM manipulations with Backbone.View include json2.js and jQuery (> 1.4.2) or Zepto.

A view is just a convention, and the underline library creates your DOM elements, although you can add some logic to it. After creating the DOM, you can manipulate it using jQuery.

0
source

Source: https://habr.com/ru/post/1400000/


All Articles