cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Component Vs Controller and Views

Former Member
1,916

Why do we have to go for Component.js when Controller and View serves the same purpose? What is the advantage of wrapping up the UI fields into a component?

TIA

View Entire Topic
boghyon
Product and Topic Expert
Product and Topic Expert

A "component", in terms of UI5, usually represents an application with the focus on a specific user role / use case.

In addition, you can describe and assign:

  • Data sources
  • Models
  • Root view
  • Navigation + involved child views
  • Extensions
  • Child components

... and many other application specific settings declaratively.

Without a component, you'd have to do it all manually somewhere in the controller.
Plus, it lets tools analyze and highly optimize your application in the build time.

Encapsulating the application assets enables us to reuse them as a group separately from other assets, such as when defining child components. See Component reuse in manifest.json.

For more information, please go through the topic Structuring: Components and Descriptor.