We are looking for guidance on best practices. We would like to have a better understanding of when to use a template, a partial or a component.
Is there any point in using partials?
Also, how do routable components impact templates or partials?
Use components. Partials are an older construct. It won’t go away right away, but I’ve seen core folks discussing whether they should start throwing deprecation errors when render partial is used …
Re templates vs components, no, you don’t need the JS part of the component. Routable components should have no effect on either partials or templates
Thanks! So even if my component contains no JS you would recommend using a components that’s just a template.hbs file.
Another way to ask that question is, should everything start as a component or should you use them only when you need JS?
Can you explain why?
Components are more decoupled, isolated and testables. They able the maintainability over time.
All SPA framework are moving to component everything approach.
I also find that things morph into more full-featured components over time If yours won’t, then yes, you could argue that you don’t need them …
Have partials been silently removed? I tried adding a partial in a new ember project and it just won’t render even though I don’t get any errors.
I’m using a 2.15 version with partials and everything all right.
Nothing has been removed, however there are a number of tricky bugs around partials in 2.15/2.16 that we are trying to get fixed. Its possible this is one of those scenarios…