Hello Payload community!
I am trying to use the payload local api inside of a react function component.
My component is inserted BeforeDashboard.
It seems the payload.init({...}) is not fully done whern the component gets called, and so payload is not properly initialized, resulting in this error :
Uncaught (in promise) TypeError: payload
WEBPACK_IMPORTED_MODULE_2.default.find is not a function
Is there maybe another way to do what I'm trying to do?
Thanks!
You cannot use the local API inside of a react component. The local API is server side only, so unless you are using something like server components, then you will need to use REST or GraphQL to interact with your data 👍
That does indeed explain everything!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.