Components are most important part of fort. It helps you to modularize your app.
There are three types of components -
If you will imagine - it will be like : your fort is consist of Walls, shields and guards.
Let's consider a real fort which has a big market and it allows people from outside to purchase and sell. They can go to any sections and sell or purchase their stuffs.
Now we might have situations, where -
- Some persons are not allowed to enter inside the fort
- Allowed inside the fort but not sections
- Allowed inside the fort and section but not a particular place inside the sections.
Components are in heirarchy order, where Wall is at top, Shield is in middle and Guard is at bottom.We can use this above concept to solve above problems -
- In order to block person from entering into fort - we need to block them using wall.
- Now person is allowed to enter inside the fort (passed from wall), but not allowed inside some particular section. To solve this problem we need to create a shield which will block them to entering inside the section.
- Now person is allowed to enter both wall, section but not some particular place inside the section. We can place a guard to make sure, only authorized/authenticated people can access.
We can also do some works inside the component and pass the result from one component to another.