Migration guide
0.6 to 0.7
react-helmet-async
is gone:Head
can now only be used for<title>
and<meta>
tags with a Remix-like API.head
property ofpreload
's return value should now be an object, notReactNode
.- You can still use
emitToDocumentHead
to 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/cli
package is not needed anymore, remove it from yourpackage.json
.rakkasjs
package is now a development dependency, move it fromdependencies
todevDependencies
in yourpackage.json
.vite
is not bundled with Rakkas anymore, install it into your project as a development dependency (npm install -D vite
).- Upgrade
react
andreact-dom
to version 18. - If you have any references to
rakkasjs/vite-types
in your code ortsconfig.json
, replace them withvite/client
. - Rename your
pages
directory toroutes
and move yourapi
directory underroutes
asroutes/api
. - Rename your
page.{jsx,tsx}
files toindex.page.{jsx,tsx}
. - Use
useLocation
instead ofuseRouter
and other navigation hooks. definePage
anddefineLayout
don't exist anymore. Replace them with (depending on the use case)- Use plain React context instead of the old layout context mechanism.
- Use the
Head
component fromrakkasjs
instead ofHelmet
fromreact-helmet-async
. - Consider using
useServerSideQuery
and 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
Request
andResponse
types instead ofRakkasRequest
andRakkasResponse
in your API routes and middleware.
0.4 to 0.5
- Remove the
@rakkasjs/runner-node
package. - Upgrade to
rakkasjs@0.5.0
and@rakkasjs/cli@0.5.0
. - Update your
start
script tonode dist/server/index.js
instead of@rakkasjs/runner-node
. - If you were using
rakkas export
to generate a static site:- Change your build command to
rakkas build -d static
. - Serve your static site from
dist
instead ofdist/static
. load
functions 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 withGET
method do the downstream fetching there sinceGET
API endpoints can now be prerendered.
- Change your build command to
NavLink
is deprecated, useStyledLink
instead.- Rename
NavLink
's props as follows:currentRouteClass
asactiveClass
currentRouteStyle
asactiveStyle
nextRouteClass
aspendingClass
nextRouteStyle
aspendingStyle
- Rename
useRouter
's return value's properties,current
is nowcurrentUrl
andnext
is nowpendingUrl
. - Return
redirect
instead oflocation
to redirect from yourload
functions.