payload__WEBPACK_IMPORTED_MODULE_2__.default.find is not a function

default discord avatar
fpnv_71336
2 months ago
2

Hello Payload community!

:blobgoodmorning:



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!

  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    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 👍

  • default discord avatar
    fpnv_71336
    2 months ago

    That does indeed explain everything!

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.