Navigation
LangSwitch
A real link to the same page in the other language, named in that language.
import { LangSwitch } from "@percentsa/ui";Examples
Code
export function LangSwitchExample() {
const { pathname } = useLocation();
const other = useLang() === "ar" ? "en" : "ar";
return <LangSwitch href={pathname.replace(/^\/(en|ar)/, `/${other}`)} />;
}