#both

1 messages · Page 1 of 1 (latest)

vapid zenith
#

@red agate What do you mean by that? Is my way of doing things right?

red agate
#

pretty much

#

you can also u se GET in react query to update stale data

#

so you don't have to rerender the whole page again

#

Its not uncomon to use Next.js with React Query to manage stale data

vapid zenith
#

@red agate Yes, I could do that with React Query, but that would mean I'd only be using the client side, if I've understood correctly, given that React Query is used on the client side (if I'm not mistaken).

red agate
#

you can prerender the data and have some sort of initially SSR'd data and pass that data to the React Query's initialData prop

#

so its not purely CSR

#

its still integrated :)

#

although i agree that the RQ part is purely client-sided

vapid zenith
#

@red agate good idea 🙂 so, for a concret example :

On my users page, I use SSR to fetch initial data (all users of my page 1, because I have a pagination). When I click on "edit", "create" or "delete", I use React Query and only Client Side Rendering ?

red agate
#

yes

#

you can use server side rendering, i.e returning HTML in server-action™️ but thats extremely experimental

#

or i.e if you are finished with Edit or Create and wish to redirect to another page, you can use server side rendering

#

but if you wish to stay in a page, its better to use RQ

vapid zenith
#

@red agate Thank you so much 🙏 so if "edit" is a new page, it's better to use client side to get the user to edit ? Or server side ? Sorry 😅

red agate
#

Depends on what to do after finished editing

#

can't say which is better without diving deep into the use case

#

for me its better to use client side to update all related data ASAP without waiting for the request to the server