Sunday, February 5, 2017

What are Nested components and component composition in lightning?

What are Nested components and component composition in lightning?


Component composition is nothing to use to ease the process.  Let’s say if you have 3 to 4 components so instead of calling all those components into your application what we do is create another component which is knows as nested component or wrapper component which calls all these components in itself and then in the application finally we can call that wrapper/Nested component only.

To save our time we are going to use this a lot in lightning applications.  Here is the example

I have 2 components as shown below


Component 1 :  LC.cmp 



Component 2 :  LC2.cmp


Wrapper Component / Nested Component:



Application:  Here I am including/adding that wrappercomponent in my NestedComponent application.

Finally what I am doing here is instead of calling LC,LC2 components, I am calling wrappercomponent that includes booth LC,LC2 components.



Once you click on the preview of your application you can see this output.




0 comments:

Post a Comment

 
| ,