ember-learn / ember-learn/guides-source

Give other (more important reason) for refactoring code in Super Rentals tutorial

Open
#1,710 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
HTML
Stars
161
Forks
512
Avg merge
4d 9h
Merged PRs (30d)
4

Description

In the Super Rental tutorial, [Part 1, Interactive Components](https://guides.emberjs.com/release/tutorial/part-1/interactive-components/#toc_testing-user-interactions) it is suggested that this code
```hbs
{{#if this.isLarge}}


View Smaller

{{else}}


View Larger

{{/if}}
```
be refactored into this code
```hbs


View {{if this.isLarge "Small" "Large"}}

```
the main reason given is code readability but in my opinion the use of the same image element, without removing one and creating another, is much more important, as when you use the first example the image loads each time isLarge is changed, causing a much worst user experience. This is a very important reason for refactoring that, in my opinion, should be outlined in the guide.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.