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

Best way to initialize and use firestack #21

Closed
IjzerenHein opened this issue Sep 6, 2016 · 1 comment
Closed

Best way to initialize and use firestack #21

IjzerenHein opened this issue Sep 6, 2016 · 1 comment

Comments

@IjzerenHein
Copy link

Hi, I've got a question concerning how to use the library.
According to the config I have to create an firestack instance like this:

const firestack = new Firestack();

However, what if I'm using Firestack in multiple files? Can I create a new instance per file in which I need it? Is this the preferred approach?

// file1.js
import Firestack from 'react-native-firestack';
const firestack = new Firestack();

... do some logic here
// file2.js
import Firestack from 'react-native-firestack';
const firestack = new Firestack();

... do some logic here

Cheers, Hein

@auser
Copy link
Contributor

auser commented Sep 6, 2016

Hein,

Thanks for the question. It's actually a singleton object, so you can call new Firestack() and it will reference the same object.

@auser auser closed this as completed Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants