javascriptreactjstypescriptpocketbase

How to use PocketBase in React


I am currently learning React and wanted to use PocketBase in my app. I installed PocketBase via npm i pocketbase --save yet when I try and run my React app, I get this message,

Cannot find module 'pocketbase' or its corresponding type declarations.
  > 1 | import PocketBase from 'pocketbase'
      |                        ^^^^^^^^^^^^

I have tried searching but the only thing I can find is deprecated. If anyone know how to do this, that would be great!


Solution

  • Looks like it may just lag from your IDE. I am getting the same thing but my app is not breaking and I also have installed pocketbase. Once I create an instance though it started working- I believe because VSCode refreshed after it had to try to fetch the type definitions.

    After VScode fetches type definitions