# How do you navigate to a record page or another page from an LWC?

**Topic:** Development · **Difficulty:** Easy · **Tags:** lwc, navigation

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-you-navigate-to-a-record-page-or-another-page-from-an-lwc

## Answer

Use **NavigationMixin** from `lightning/navigation`:

```javascript
import { NavigationMixin } from 'lightning/navigation';

export default class Nav extends NavigationMixin(LightningElement) {
  goToRecord() {
    this[NavigationMixin.Navigate]({
      type: 'standard__recordPage',
      attributes: { recordId: this.recordId, actionName: 'view' }
    });
  }
}
```
Common `type` values: `standard__recordPage`, `standard__objectPage`, `standard__webPage`, `standard__navItemPage`, `comm__namedPage` (Experience Cloud). Use `GenerateUrl` to get a URL instead of navigating.

---
Source: ForceChallenges · last updated 2026-10-19
