Navigation

This allows micro-frontends to redirect users to different routes managed by the shell without direct access to the shell's router.

Client applications can request navigation within the shell application.

How It Works

  1. Client calls navigate({ path: '/target-path' })

  2. Request is sent to shell via framebus

  3. Shell executes navigation using its router

  4. URL changes and appropriate content is rendered

Basic Usage

Use the navigate function from useAppClient:

import { useAppClient } from '@akinon/app-client';

const NavigationExample = () => {
  const { navigate } = useAppClient();

  return (
    <div>
      <button onClick={() => navigate({ path: '/dashboard' })}>
        Dashboard
      </button>
      <button onClick={() => navigate({ path: '/orders' })}>
        Orders
      </button>
      <button onClick={() => navigate({ path: '/settings' })}>
        Settings
      </button>
    </div>
  );
};
Property
Type
Description

path

string

Target path to navigate to (should start with /)

external

boolean

If true, navigates at shell level instead of extension level

circle-info

Understanding external:

  • external: false (default) → Navigates within extension scope Example: /dashboardshell.com/en/en-us/extension/1/dashboard

  • external: true → Navigates at shell level Example: /dashboardshell.com/en/en-us/dashboard

Simple Navigation

With Query Parameters

Dynamic Routes

Shell-Level Navigation

Navigate to shell routes (outside extension scope):

circle-exclamation

Client-Side Navigation

For fullpage applications, you can also configure internal navigation:

When the shell triggers NAVIGATE_CHILD event, your navigation.navigate function is called.

Programmatic Navigation Patterns

After Form Submission

Conditional Navigation

Best Practices

1. Use Meaningful Paths

2. Handle Navigation Errors

3. Avoid Navigation on Mount

Don't navigate immediately on component mount - let the user interact first:

Next Steps

  • Actions - Invoke shell actions

  • Hooks - Complete useAppClient reference

Last updated

Was this helpful?