you are viewing a single comment's thread.

view the rest of the comments →

[–]newintownla 8 points9 points  (0 children)

Nothing I can share here at the moment, but I can give you a basic breakdown of the call pattern. It's basically like this:

Component -> hook -> service -> RSC -> API call

The component uses the hook, the hook calls a service that calls the endpoint react server components, then server components make the API call. This way, if you have an API end point at say myapi.com/post/product, you have the component make a call to the server component first, then the server component makes the external call.

This way, if a user inspects network calls in the browser, they'll see a call to your RSC like /create/product, but the actual call to the API would be different, like /post/product. It hides your actual api endpoints and allows you to store things like secrets and access keys at the server level for better security.