Skip to content

Commit 37f32da

Browse files
author
ying.liu
committed
revise smart component
1 parent 934ab8c commit 37f32da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

frontend/angular-best-practices.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Here is a set of best practices using Angular.
66

77
The overall Angular application could be organized into two types of components: [smart components and presentational components](https://blog.angular-university.io/angular-2-smart-components-vs-presentation-components-whats-the-difference-when-to-use-each-and-why/).
88

9-
- Smart component: aslo called application level component or container component. A smart component usually retrieves data using services and may use presentational components to display data.
10-
- Presentational components: also known as pure component or dumb component. It receives its data from parent smart component using `@Input()` binding. It uses `@Output()` event to communicate with its parent component.
9+
- Smart component: aslo called stateful component or container component. A smart component usually retrieves data using services and may use presentational components to display data.
10+
- Presentational components: also known as pure component or stateless component. It receives its data from parent smart component using `@Input()` binding. It uses `@Output()` event to communicate with its parent component.
1111

12-
If there are multiple level between a smart component and a presentational component, use RxJS's `subject` to communicate via a service. This should be carefully documented in all components involved in the communication.
12+
Presentational component should only use `@Input()` and `@Output()`. If there are multiple level between a smart component and a presentational component, use RxJS's `subject` to communicate via a service. This should be carefully documented in all components involved in the communication.
1313

14-
The `ngrx/store` is not recommended because the depency injection and RxJS can solve most problems in a more elegent way.
14+
The `ngrx/store` is not recommended because the Angular's dependency injection and RxJS can solve most problems in a more elegent way.
1515

1616
## Change Detection Strategy
1717

0 commit comments

Comments
 (0)