ur welcome!
thank you for this detailled answer! 🙂
You could probably also make a custom endpoint to use the local API and get the data you want. And then fetch from your custom endpoint from your react component
Same thing happens in the payload core too, e.g.
https://github.com/payloadcms/payload/blob/de2ae5ec15be37b84cdae5ed4e38291e6b2b8123/src/admin/components/views/collections/Edit/index.tsx#L50Since that's client-side, you can do that with hooks & fetch requests. So first check out
https://payloadcms.com/docs/admin/hooks#useconfig- you can use those in your component, especially useConfig.
Also check out
https://github.com/AlessioGr/payload-plugin-lexical/blob/9c6a7672fd782d39e63139dafef4d6a9454170a2/demo/src/customLexicalFeatures/inlineProduct/nodes/ProductDisplayComponent.tsx#L40as an example for how I fetch collection data from the payload db. It's just a simple fetch in the end.
basically i try to build a dashboard overview in payload, loading several data from the payload db
so the local API should only be used server-side. For react components there's a bunch of hooks you can use which you can use though - they do something similar!
Question from
@441722987817730058: Is it possible to use the local payload api in custom react components in the admin dashboard ui?
Star
Discord
online
Get dedicated engineering support directly from the Payload team.