Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ created_at: '2023-03-20T23:45:13Z'

Route Loaders load data in the server so it becomes available to use inside Qwik Components. They trigger when SPA/MPA navigation happens so they can be invoked by Qwik Components during rendering.

Please note that route loaders should be exported only from `layout.tsx` or `index.tsx` files. But they can be declared in any valid way ES modules allow. To reuse a route loader across multiple `layout.tsx` or `index.tsx files, define it in a separate file, export it, then import it in `layout.tsx` or `index.tsx files and [`re-export`](/docs/(qwikcity)/re-exporting-loaders/index.mdx) it as a named export.
Please note that route loaders should be exported only from `layout.tsx` or `index.tsx` files. But they can be declared in any valid way ES modules allow. To reuse a route loader across multiple `layout.tsx` or `index.tsx` files, define it in a separate file, export it, then import it in `layout.tsx` or `index.tsx` files and [`re-export`](/docs/(qwikcity)/re-exporting-loaders/index.mdx) it as a named export.

> If you want to manage common reusable routeLoader$s it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception. For more information [check this section](/docs/(qwikcity)/re-exporting-loaders/index.mdx).

Expand Down
Loading