Background
Aura supports component inheritance. Mark a component extensible="true" and others can extend it—so shared logic lives in one place.
A BaseComponent built on that idea became a reusable asset across Aura projects: callouts, spinners, errors, navigation, and more, with ongoing improvements over time.
Problem statement
- Most components need the same basics: Aura-enabled Apex, loading state, error handling, navigation
- Typos in controller/helper JavaScript are costly to debug
- Lightning Out from Classic breaks events that work in LEX
- Branding and cross-cutting behavior should apply consistently
Solution
Extend a generic base component that owns shared helpers and adapts Classic vs Lightning behavior.
Helpers include:
startWaiting/stopWaiting– spinner around async workdoCallout– Aura-enabled method with parameters and callbacknavigateToRecord– record navigation (LEX and Classic)handleErrors– normalize errors and show toastsgetAllUrlParams– parse URL parametersdoShowToast– toast helper for both experiencesdoCloseModel– close a modal via the overlay librarymyLog– centralized logging you can prefix or disable in one placedoRefresh–force:refreshViewin LEX; page reload in ClassicdoNewModel– open a modal for a component and attributesdoNavigateToObjectHome– sObject home (LEX)doShowNotif– notification library (toast in Classic)doNavigateToCommunityHome– community homecloseAllToasts– dismiss sticky toastscreateRecord–force:createRecordcloseFocusedTab/consoleOpenTab– console helpers
Examples
Extending the base component:
Calling base helpers from a child controller:
Calling from a child helper (helper or this):
Resources
- Lightning:
BaseComponent
Pre-deployment steps
- Back up the target org; merge carefully if resources already exist.
- Install or remove any documented dependencies (such as Dynamic Code Execution) as needed.
Deployment steps
Source: BaseComponent
Post-deployment steps
Deploy, extend BaseComponent from your custom components, and call the shared helpers as shown above.