Ability to use expo-sqlite outside of React components?

  1. SDK Version: 36.0.0
  2. Platforms(Android/iOS/web/all): Android/iOS

I’ve been trying out the expo-sqlite library today, and I’ve run into a frustrating wall trying to use it. I wanted to create a migration system, so I want to write some functions outside of React components. However, due to the callback-based API, I can’t find a way to get data out of the ResultSets other than in a React component, like in the example app where it uses useState and useEffect hooks. I would like to be able to chain async/await functions like many other Expo SDK APIs. This would allow me to do things like write an async lastMigration function that can return data other functions can use, and would make my code much, much more testable.

I’m not a very experienced JS programmer, so if I’m missing an option, please advise. Thanks.


Could you post some example code to show what you’re trying to do? I’m not entirely sure what you mean. Even if you post something where you pretend that expo-sqlite provides an API that allows you to “chain async/await functions”.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.