use client
We are using tsup for our bundler, but right now it will remove all the use client
flag. We need to declare the JavaScript banner by ourselves. But this can mess up the server side function, as a workaround, we centralize the server side function in the toolkit/src/server folder and we stop adding use client
tsup JavaScript banner there.
The client side can’t not live in server side component. But sometime we want to leverage react hook beside the page.ts
file. The convention we have is we have three file in the router
The first of three is the pre-defined file by Nextjs. The third file is an skeleton for us to encapsulate all the client file into it and cast a use client
banner on it. In this way, the convention of app router can be properly unified.
Collation is very important on maintaining and debugging react-query. But at the same time, we need to separate client-side and server-side code. The convention we built here is each react-query-service will have three file
toolkit/src/server
entry point to stop tsup from adding use client
banner on our server side file.next/router
is replaced with next/navigation