Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6681757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:37:35+00:00 2026-05-26T04:37:35+00:00

In most BackboneJS examples I’ve seen, parent views call the render() function on child

  • 0

In most BackboneJS examples I’ve seen, parent views call the render() function on child views. This seems a little odd to me. Maybe it’s completely for optimization or something, but I don’t see why the optimization couldn’t take place within the child view itself. Shouldn’t the child view be responsible for calling its own render()? It seems like in all my views I end up with something like:

initialize: function() {
    this.render();
}

Also, if my parent view updates the child view’s model property, how is the child supposed to know that the model changed (and therefore render() needs to be called)? I assume in this case the parent is forced to call the child’s render(). Although it’s somewhat inferred, why should the parent need to know that the child needs to re-render when its model is changed? It seems like calling the render function of the child view is outside of the parent view’s domain.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:37:36+00:00Added an answer on May 26, 2026 at 4:37 am

    Like pretty much everything Backbone-related, this is a pretty subjective question. But here are a few reasons you might want the parents to render:

    • It’s perfectly reasonable to think that the parent view might need to make sure that the child views are rendered before the rest of the rendering takes place. For example, the parent might need to size a container element based on the size of its children, or show a container only once its contents are rendered by the child views.

    • Your “render on initialize” pattern only works if you don’t need to do other things first – for example, one common pattern is for the view to bind to the model’s change event, call this.model.fetch(), and render in the callback. In this case, especially if you care about execution order of the different renders, it’s nice to have a single event listener on the parent and then have the parent deal with rendering children, rather than having bindings with every child, even though those children won’t be calling fetch().

    • Also, having the parent render the children doesn’t preclude the children re-rendering themselves, e.g. in response to more specific events. Having the parent call child.render() just helps to ensure that this has happened by the time the parent is finished rendering.

    It’s also worth noting that views have a default no-op for render. So the parent can call render() on the child without having to be sure it’ll do anything.

    In answer to “what if the parent changes the child’s model?”, one option is, don’t do that – always create a new child for each new model. But that might not fit your architecture – in which case having the parent responsible for re-rendering the child makes perfect sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Most of the examples I have seen online have something similar to: FileOutputStream out
Most of the examples I found on the net write this: if(x != nil)
Most of the render function in the following view is irrelevant, I think but
Most of the implementations I find require a hardware instruction to do this. However
Most of the MVC samples I have seen pass an instance of the view
Most browsers display ordered lists like this: 1. foo 2. bar 3. baz Is
Most of the time I have been programming little apps either for myself or
most of the time in the service code I would have something like this:
Most com methods have a signature like this: STDMETHOD(someFunc) (THIS_ ParamType param) PURE; Which
Most examples I can find showing how to work with attributes show how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.