Skip to content

Commit

Permalink
Deprecate {{partial}} (#456)
Browse files Browse the repository at this point in the history
Deprecate `{{partial}}`
  • Loading branch information
rwjblue authored Oct 25, 2019
2 parents 4a48a0e + 07a20c4 commit 1e4d8a5
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions content/ember/v3/partial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
id: ember.partial
title: Deprecate `{{partial}}`
until: '4.0.0'
since: '3.15'
---

We are deprecating usage of `{{partial}}` in accordance with [RFC #449](https://github.com/emberjs/rfcs/blob/master/text/0449-deprecate-partials.md).

Partials should be migrated to components. For example, consider the following `quick-tip` partial:

```hbs
{{! app/templates/application.hbs }}
{{#let (hash title="Don't use partials" body="Components are always better") as |tip|}}
{{partial "partials/quick-tip"}}
{{/let}}
```

```hbs
{{! app/templates/partials/quick-tip.hbs }}
<h1>Tip: {{tip.title}}</h1>
<p>{{tip.body}}</p>
<button {{on "click" this.dismissTip}}>OK</button>
```

It can be converted to a component as follows:

```hbs
{{! app/templates/application.hbs }}
{{#let (hash title="Don't use partials" body="Components are always better") as |tip|}}
<QuickTip @tip={{tip}} @onDismiss={{this.dismissTip}} />
{{/let}}
```

```hbs
{{! app/templates/components/quick-tip.hbs }}
<h1>Tip: {{@tip.title}}</h1>
<p>{{@tip.body}}</p>
<button {{action @onDismiss}}>OK</button>
```

0 comments on commit 1e4d8a5

Please sign in to comment.