#oh so now it s a client side so any idea

1 messages ยท Page 1 of 1 (latest)

torn talon
#

What does your whole page component look like

misty vapor
#

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;```
torn talon
#

can you edit the format so it looks like code

misty vapor
#

i dont know how ๐Ÿ˜…

torn talon
#

three back ticks i think

misty vapor
#

oh yeah thanks

torn talon
#

userdashboard is a client component?

misty vapor
#

yes

#
function UserDashboard({ params, userData }) {
  // initial page data
  const [form, setForm] = useState(userData[0]);
torn talon
#

you'll need to refetch the route or data in the client component

misty vapor
torn talon
#

useEffect with pathname depdendency and router.refresh() or use something like react-query on the server and client (this is what i use)

misty vapor
#

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 ๐Ÿ’œ