Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate {{partial}} #456

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
```