I have lots of nested components in my next.js application.
And for getting translations i rely on the params.lang
.
Now i have drill this to every single component.
I know there are hooks, but i want to render them as server components.
Is there any workaround to avoid prop drilling and get access to params.lang
inside NESTED server components?
import { getDictionary } from "@/get-dictionary";
import React from "react";
type Props = {
link: string;
};
const ShareButton = (props: Props) => {
// something here to get the params.lang without relying on props?
const locale = ?
const dictionary = await getDictionary(locale)
return <div>ShareButton</div>;
};
export default ShareButton;