The-Commit-Company / frappe-react-sdk

React hooks for Frappe
https://frappe-react.vercel.app
MIT License
107 stars 36 forks source link

Feedback for “Other Frameworks” #34

Closed amrishshah closed 1 year ago

amrishshah commented 1 year ago

is this module can be used in next js framework ?

nikkothari22 commented 1 year ago

Hey @amrishshah - technically, yes. Under the hood, frappe-react-sdk uses SWR (made by the Vercel team themselves). However, all API calls will be made from the client - not from the server. You can read more about SWR's support for React Server components and NextJS here: https://swr.vercel.app/docs/with-nextjs. This is okay if you wish to make API calls from the client though.

If you want to make full use of NextJS's SSR capabilities, you would have to make those API calls from server components in NextJS. While you can't use frappe-react-sdk for that, you can use frappe-js-sdk (the library being used under the hood in frappe-react-sdk) to interface with your Frappe server.

amrishshah commented 1 year ago

If possible could have some pointer add in the document?

I will check this document, as i don't want to use api key and secret key ..

On Wed, Aug 23, 2023, 5:09 PM Nikhil Kothari @.***> wrote:

Hey @amrishshah https://github.com/amrishshah - technically, yes. Under the hood, frappe-react-sdk uses SWR (made by the Vercel team themselves). However, all API calls will be made from the client - not from the server. You can read more about SWR's support for React Server components and NextJS here: https://swr.vercel.app/docs/with-nextjs. This is okay if you wish to make API calls from the client though.

If you want to make full use of NextJS's SSR capabilities, you would have to make those API calls from server components in NextJS. While you can't use frappe-react-sdk for that, you can use frappe-js-sdk (the library being used under the hood in frappe-react-sdk) to interface with your Frappe server.

— Reply to this email directly, view it on GitHub https://github.com/The-Commit-Company/frappe-react-sdk/issues/34#issuecomment-1689806540, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6O7QV5XMUJVYIY2UUJB4TXWXTWZANCNFSM6AAAAAA3ZWH47I . You are receiving this because you were mentioned.Message ID: @.***>

nikkothari22 commented 1 year ago

I haven't used NextJS in a while (and haven't ever tried out RSCs), so won't help be of much help to you.

But in short:

  1. On the client - you can use frappe-react-sdk. We use this on our client side React apps with Vite.
  2. On the server - you can use frappe-js-sdk - but I'm not sure how NextJS handles cookies so that might be an issue.
amrishshah commented 1 year ago

Thanks for the tip!

On Thu, Aug 24, 2023, 1:44 AM Nikhil Kothari @.***> wrote:

I haven't used NextJS in a while (and haven't ever tried out RSCs), so won't help be of much help to you.

But in short:

  1. On the client - you can use frappe-react-sdk. We use this on our client side React apps with Vite.
  2. On the server - you can use frappe-js-sdk - but I'm not sure how NextJS handles cookies so that might be an issue.

— Reply to this email directly, view it on GitHub https://github.com/The-Commit-Company/frappe-react-sdk/issues/34#issuecomment-1690575176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6O7QV7QUE7IRNMUHLVJ4DXWZQBRANCNFSM6AAAAAA3ZWH47I . You are receiving this because you were mentioned.Message ID: @.***>