Migration guide
0.6 to 0.7
react-helmet-asyncis gone:Headcan now only be used for<title>and<meta>tags with a Remix-like API.headproperty ofpreload's return value should now be an object, notReactNode.- You can still use
emitToDocumentHeadto inject arbitrary HTML into the document head.
0.5 to 0.6
This is the largest update so far with a lot of breaking changes. The whole data fetching system has been redesigned to use React Suspense and streaming SSR. We apologize for the inconvenience but we feel the changes are justified because they take the developer experience to a whole new level.
- Upgrade to
rakkasjs@0.6.0. @rakkasjs/clipackage is not needed anymore, remove it from yourpackage.json.rakkasjspackage is now a development dependency, move it fromdependenciestodevDependenciesin yourpackage.json.viteis not bundled with Rakkas anymore, install it into your project as a development dependency (npm install -D vite).- Upgrade
reactandreact-domto version 18. - If you have any references to
rakkasjs/vite-typesin your code ortsconfig.json, replace them withvite/client. - Rename your
pagesdirectory toroutesand move yourapidirectory underroutesasroutes/api. - Rename your
page.{jsx,tsx}files toindex.page.{jsx,tsx}. - Use
useLocationinstead ofuseRouterand other navigation hooks. definePageanddefineLayoutdon't exist anymore. Replace them with (depending on the use case)- Use plain React context instead of the old layout context mechanism.
- Use the
Headcomponent fromrakkasjsinstead ofHelmetfromreact-helmet-async. - Consider using
useServerSideQueryand action handlers instead of API routes for data fetching. - Rename your
*.endpoint.{js,ts}files as*.api.{js,ts}andendpoint.{js,ts}asindex.api.{js,ts}. - Use standard
RequestandResponsetypes instead ofRakkasRequestandRakkasResponsein your API routes and middleware.
0.4 to 0.5
- Remove the
@rakkasjs/runner-nodepackage. - Upgrade to
rakkasjs@0.5.0and@rakkasjs/cli@0.5.0. - Update your
startscript tonode dist/server/index.jsinstead of@rakkasjs/runner-node. - If you were using
rakkas exportto generate a static site:- Change your build command to
rakkas build -d static. - Serve your static site from
distinstead ofdist/static. loadfunctions in static sites will now run like in normal sites instead of caching their results. If you're relying on a slow or ever-changing external API, create internal API endpoints accessed withGETmethod do the downstream fetching there sinceGETAPI endpoints can now be prerendered.
- Change your build command to
NavLinkis deprecated, useStyledLinkinstead.- Rename
NavLink's props as follows:currentRouteClassasactiveClasscurrentRouteStyleasactiveStylenextRouteClassaspendingClassnextRouteStyleaspendingStyle
- Rename
useRouter's return value's properties,currentis nowcurrentUrlandnextis nowpendingUrl. - Return
redirectinstead oflocationto redirect from yourloadfunctions.