Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: react hooks? #566

Closed
3 of 12 tasks
jonathan-chin opened this issue Feb 19, 2024 · 1 comment
Closed
3 of 12 tasks

feat: react hooks? #566

jonathan-chin opened this issue Feb 19, 2024 · 1 comment
Labels
feature Feature wontfix This will not be worked on

Comments

@jonathan-chin
Copy link

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

@robingenz
Copy link
Member

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.

@robingenz robingenz added wontfix This will not be worked on and removed needs: triage labels Feb 19, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants