InterviewSolution
| 1. |
What do you understand by a Lean Component in Angular? |
|
Answer» A lean component is a component which have the sole purpose to display or present data to user. Lean components delegate data fetching, BUSINESS logic, input validation ETC. to other classes like models, services, redux effects/actions etc. Lean component follows single RESPONSIBILITY principle and they receive the data as an input from outside the component and present it to the user as specified in the component template.. They receive the data that they need to display and then present the data to the user in the specified templated formatting. The following is an example component, the user profile component. <user-profile [user]="user"></user-profile>The component takes an object user and the rest of the job of the component is to display the data to the user in a nice and clean UI. The component does not deal with any other business logic or computations in the APP. |
|