#oh so now it s a client side so any idea
1 messages ยท Page 1 of 1 (latest)
like this
import PageNotFound from "@/app/not-found"; export const fetchCache = "force-no-store"; export const revalidate = 0; // seconds export const dynamic = "force-dynamic"; async function getUserData(userName) { const response = await fetch(`http://localhost:5000/users/${userName}`, { cache: "no-store", }); return response.json(); } async function Dashboard({ params }) { const { userData } = await getUserData(params.id); if (!userData) { return <PageNotFound />; } console.log("userData", userData); return ( <div> <UserDashboard userData={userData} params={params} /> </div> ); } export default Dashboard;```
can you edit the format so it looks like code
i dont know how ๐
three back ticks i think
oh yeah thanks
userdashboard is a client component?
yes
function UserDashboard({ params, userData }) {
// initial page data
const [form, setForm] = useState(userData[0]);
you'll need to refetch the route or data in the client component
that what i was afraid of, i was thinking to avoid many fetches
useEffect with pathname depdendency and router.refresh() or use something like react-query on the server and client (this is what i use)
it will work with useeffect but at the cost of many data coming from the server
i did search for solution and found many having the same issue with no solutions, then i believe there's no solutions except this one you just said
but it's more like a trick than a solution
since no solution could be found i will use the useeffect things and thank you so much for the time you spent trying to help me MUCH APPRECIATED ๐