Skip to content

ILC transition hooks

ILC allows you to check a route before navigating to it.

To handle it, you need to create an ILC transition hooks plugin using the ILC plugins SDK to cover cases that depend on accessing any route.

ILC transition hooks

ILC transition hooks plugin⚓︎

ILC transition hooks plugin should follow a specific interface that the ILC plugins SDK provides for this plugin.

ILC gets transition hooks from the plugin and calls them before navigating a route. It works for both SSR and CSR.

There are the following options to handle the navigation event: 1. Stop navigation and use your custom behavior such as authentication form as an example to navigate whenever you need (CSR). 2. Redirect to a new location (CSR, SSR). 3. Continue navigation (CSR, SSR).

From ILC, every transition hook receives route information (URL, route meta information that a route has in the ILC registry).

The provided route information allows you to handle only the routes that you need. For example, in the ILC Registry, you can mark some routes as protected in the Metadata field, and handle navigation to those marked routes as required.

Route meta field in ILC registry

Example of the default ILC transition hooks plugin

Check an example of the default ILC transition hooks plugin in ILC plugins SDK

Server-side API⚓︎

Transition hooks are asynchronous on the server-side.

From ILC, every hook receives route information, ILC logger, and the current request on the server-side.

You have to use the ILC logger when you need to log inside of your hook. ILC has its own log interface on the server-side, so every application or plugin should follow it.

Client-side API⚓︎

Transition hooks are synchronous on the client side. ILC calls them on each History change event.

From ILC, every hook receives route information and navigate method on the client-side.

Whenever you need to navigate to a route from your hook, you need to use that provided navigate method to keep the ILC SPA routing mechanism safe.


Check the demo website to see how hooks work in ILC.

Back to top