Q&A
- Why a View is appropriate and not the Router (as a central piece to organise your code)
Router are bit disconnected from the app. They work better when they are stateless. So he argues, a router would create new objects each time a request is passed through it. Unless you dispose the object every time, it would add up to a lot of objects over time.
The centerpiece of your app is the DOM, or the page. He prefers the router to be a child of the router.
- Is there a way to lazy-load data or a view?In a views render method to actively fetch from the server.
You can advantage of the fact the jQuery.ajax creates a deferred object (similar in concept to a promise). It has a
done()
method that you can use to kick of rendering.