aws-amplify / aws-amplify/docs
gen2/start/quickstart/nextjs-app-router-server-components displays wrong function to use on client side
- Dominant language
- MDX
- Stars
- 506
- Forks
- 1.1k
- Avg merge
- 3h 14m
- Merged PRs (30d)
- 1
Description
**Describe the content issue**:
At this point in the documentation in the code provided you use
```// components/Login.tsx
"use client";
import { withAuthenticator } from "@aws-amplify/ui-react";
import { AuthUser } from "aws-amplify/auth";
import { redirect } from "next/navigation";
import { useEffect } from "react";
function Login({ user }: { user?: AuthUser }) {
useEffect(() => {
if (user) {
redirect("/");
}
}, [user]);
return null;
}
export default withAuthenticator(Login);
```
However according to nextjs documentation [here](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#userouter-hook) you should use either useRouter hook or the Link component to accomplish this because this component is a client side component. Pretty minor issue, but thought I'd report it nonetheless.
**URL page where content issue is**:
https://docs.amplify.aws/gen2/start/quickstart/nextjs-app-router-server-components/#add-server-authentication-routes
Contributor guide
Assessment
This issue has not been assessed yet.