in a Next.js server component, you can get route parameters from params.
Example:
This is the route:
/app/[locale]/page.tsx
url would be
http://localhost:3000/es
Page example:
interface Params {
locale: string
}
async function MyPage({ params }: { params: Params }) {
const { locale } = params
console.log(locale)
return (
<h1>My page</h1>
)
}