async apis' change make client components act ridiculously #76140
Replies: 3 comments 1 reply
-
|
Next.js 15 makes useParams() and useSearchParams() return promises in Client Components, causing unexpected re-renders you can await inside the useEffect() like this. |
Beta Was this translation helpful? Give feedback.
-
|
What about: const Page: FC = (props) => {
const params = use(props.params);
const searchParams = use(props.searchParams);
} |
Beta Was this translation helpful? Give feedback.
-
|
Your approach of use(props.params) will not work in Client Components in the same way that use works in Server Components. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
look at this innocent client component
and below is whatever reported


this component act twice immediately just because now params and searchParams are promises
What's the point of this?
Why must client components accept props of server components?
or the compiler is blind so that it cannot read 'use client' at the top of file?
By the way , a 'NextServerComponentProps' is needed
I cannot stand coding like this
Beta Was this translation helpful? Give feedback.
All reactions