Navigate To Component (Deprecated)
force:navigateToComponent
Navigates from an Aura component to another.
This event is deprecated. We recommend using the lightning:navigation component with the standard__component page type instead.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App
This event enables you to navigate from one Aura component to another.
Starting in API version 43.0, the force:navigateToComponent event is deprecated. For more information, see Components with Minimum API Version Requirements. We recommend implementing the lightning:isUrlAddressable interface on your target component and navigating to the component using the lightning:navigation component with the standard__component page type instead. This generates a route in the format /cmp/{componentName}?myAttr=attrValue.
To navigate from a component to another, specify the component name using componentDef. This example navigates to a component c:myComponent and sets a value on the contactId attribute. The componentAttributes are base-64 encoded into the URL.
Even when using HTTPS, including personal data for URL parameters isn’t safe. See Storing Sensitive Data for details.
When fired from a component embedded in Lightning Experience or Salesforce mobile app, the app creates and renders the target component in the app content area, replacing the current content. If you create a tab and associate it directly with the component, this event lets you navigate to the tab associated with the target component. For more information, see Add Lightning Components as Custom Tabs in a Lightning App.
This event doesn’t support target components that are embedded in another tab or in multiple tabs. You can navigate only to a component that’s marked access="global" or a component within the current namespace. Don’t depend on the URL generated by this event. It appears in the browser location bar and can be bookmarked, but the URL isn’t permanent.
This event is handled by the one.app container. It’s supported in Lightning Experience and the Salesforce mobile app.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
componentAttributes | The attributes for the component. | object | ||
componentDef | The component to navigate to, for example, c:myComponent. | string | ||
isredirect | Specifies whether the navigation is a redirect. If true, the browser replaces the current URL with the new one in the navigation history. This value defaults to false. | boolean | false |