function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ken Koellner @ EngagewareKen Koellner @ Engageware 

Nested Lighting components calling Apex Aura Controllers

Question about design patterns for Lighting Aura components.  I'm working on a feature that will have some nested components.  Like a main component, a couple components that manage lists, and a couple components that present an item for the list.

The main component will have a back-end Apex controller in Apex. 

Is the best patern to also declare some of the inner components to have their own Apex.  For example, list component would call their controller to get data.   

Or would be be better for the inner components to always use the controller for the main component, and if so, is there a example of a coding pattern for doing so?

I seem to remember a lecture on Lightning Aura components when they were new covering this topic and having examples but since it was a couple years ago, I don't recall where I saw it.
Rahul Kumar DeyRahul Kumar Dey
Hi Ken,

You can use component event to pass the list of records whatever you get in your child component (coupleComponent) to parent component
(mainComponent).

Let me know if you need further clarification,

Thanks,
Rahul