Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Angular Components

You're reading from   Mastering Angular Components Build component-based user interfaces with Angular

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher Packt
ISBN-13 9781788293532
Length 402 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Gion Kunz Gion Kunz
Author Profile Icon Gion Kunz
Gion Kunz
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Component-Based User Interfaces FREE CHAPTER 2. Ready, Set, Go! 3. Dealing with Data and State 4. Thinking in Projects 5. Component-Based Routing 6. Keeping up with Activities 7. Components for User Experience 8. Time Will Tell 9. Spaceship Dashboard 10. Putting Things to the Test 11. Other Books You May Enjoy

The right size of components

Our task list is displayed correctly and the code we used to achieve this looks quite okay. However, if we want to follow a better approach for composition, we should rethink the design of our task list component. If we draw a line at enlisting the task list's responsibilities, we would come up with things such as listing tasks, adding new tasks to the list, sorting or filtering the task list; however, operations are not performed on an individual task itself. Also, rendering the task itself falls outside of the responsibilities of the task list. The task list component should only serve as a container for tasks.

If we look at our code again, we will see that we're violating the single responsibility principle and rendered the whole task body within our task list component. Let's take a look at how we can fix this by increasing the granularity...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime