I use pretty the same example as documentation does.
My full code (literally nothing more):
import React from "react";
import { redirect, permanentRedirect } from 'next/navigation'
export default function Index(params) {
permanentRedirect('/licenseKeys')
}
For sure I can use redirect()
function instead, but I need to mark this redirect as permanent.
I investigated the next/navigation
file, and there is no permanentRedirect()
function, only regular redirect()
.
This looks like some stupid mistake like "one wrong character", but I copy-pasted the example from Next.js documentation, and nothing changed. Maybe somebody knows where I am wrong? Or is it Next.js docs lie to us?
This function is documented but not released yet. It's already in the
canary
release. You can install it bynpm install next@canary
(use at your own risk).The documentation of
peremanentRedirect
is made two weeks ago in this pull request But, the function is not yet released in a stable release.