Pages and basics

In Rakkas, a page is a React component default exported from a module in the src/routes directory with a name that matches *.page.jsx (or tsx).

Rakkas has a file system-based router. The file name determines the URL path. The rules are as you would expect:

Module nameURL path
src/routes/index.page.jsx/
src/routes/about.page.jsx/about
src/routes/about/index.page.jsxalso /about

This specific naming convention (<name>.page.{extension}) allows you to have your helper libraries and components next to your page components without accidentally exposing them as routes.

A very simple Rakkas page would look like this:

Head component

Rakkas provides a Head component for managing document head tags. It is simply a repackaging of the react-helmet-async package.

Fast refresh

Rakkas supports Fast Refresh which allows you to edit your components and get immediate feedback for your changes without having to reload the page. Function components will be updated without losing their state (class components will lose their state). If you open one the examples above in CodeSandbox and edit a file, the changes will be instantly reflected in the preview.

Fast Refresh only works on files that only export React components. Exporting any other value will fall back to a full reload. Exporting types is OK.