capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.

Home Page:https://capawesome.io/plugins/firebase/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: react hooks?

jonathan-chin opened this issue · comments

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Current problem

I'm trying to write a few programs that use react, reactfire, capacitor, and this plugin. however, it seems that this plugin is based heavily on Promises, which aren't fully supported in react functional components. with react's suspense, we can achieve a functionality similar to async / await with hooks; we can wait until the hook completes and instead render a different component.

I can use promises in React with a workaround but it would be far better if there were react hooks. is this possible? I'm also happy to develop and PR some code but would need some guidance first.

Preferred solution

It would be great to have a similar interface as reactfire's implementation. for example:

import {useUser} from 'reactfire';
[...]
const {user} = useUser();

Alternative options

No response

Additional context

No response

Before submitting

however, it seems that this plugin is based heavily on Promises

Yes, this is how Capacitor plugins work. Unfortunately, React hooks are not in the scope of this plugin. For one thing, I have no experience with React myself. Secondly, the maintenance of all plugins is already very time-consuming. Adding framework-specific code to the plugins would not be maintainable for me. For this reason, I am currently not planning to add any support.