How do I use the Firebase onAuthStateChange with the new React Hooks?Loop inside React JSXProgrammatically navigate using react routerReact login with firebase async issueStop React Higher Order Component from mounting before wrapped component?react firebase authentication with apollo graphqlHow to pass Firebase Authentication state from native Swift code to React Native viewFirebase Authentication & ReactReact router auth patternProblem with protected routes, context API and firebase user authentication requestUse HOC, React Context and componentDidMount API to get uid form Firebase
Why would an invisible personal shield be necessary?
Would it take any sort of amendment to make DC a state?
Bouncing map back into its bounds, after user dragged it out
How to choose using Collection<Id> rather than Collection<String>, or the opposite?
Does Ubuntu reduce battery life?
Why does calling cout.operator<<(const char*) print the address instead of the character string?
Create two random teams from a list of players
Is it okay for me to decline a project on ethical grounds?
Word for giving preference to the oldest child
Security measures that could plausibly last 150+ years?
Can you continue the movement of a Bonus Action Dash granted by Expeditious Retreat if your Concentration is broken mid-move?
Why are we moving in circles with a tandem kayak?
Efficiently finding furthest two nodes in a graph
Avoiding Implicit Conversion in Constructor. Explicit keyword doesn't help here
What are the closest international airports in different countries?
On the sensitivity conjecture?
Should I intervene when a colleague in a different department makes students run laps as part of their grade?
Coworker mumbles to herself when working, how to ask her to stop?
A basic question on circuits and matrix representation
Did Vladimir Lenin have a cat?
How to have poached eggs in "sphere form"?
Why didn't Stark and Nebula use jump points with their ship to go back to Earth?
How do I make my photos have more impact?
Why did Windows 95 crash the whole system but newer Windows only crashed programs?
How do I use the Firebase onAuthStateChange with the new React Hooks?
Loop inside React JSXProgrammatically navigate using react routerReact login with firebase async issueStop React Higher Order Component from mounting before wrapped component?react firebase authentication with apollo graphqlHow to pass Firebase Authentication state from native Swift code to React Native viewFirebase Authentication & ReactReact router auth patternProblem with protected routes, context API and firebase user authentication requestUse HOC, React Context and componentDidMount API to get uid form Firebase
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am using Firebase
to authenticate users for my application. I have created the SignIn
and SignUp
forms and can successfully create new users and sign in with stored users. However the issue comes with maintaining the user logged in state after a Reload
.
The way I have seen it done in tutorials is to use a HOC
like the following to check if the current user is logged in.
const withAuthentication = Component =>
class WithAuthentication extends React.Component
constructor(props)
super(props);
this.state =
authUser: null,
;
componentDidMount()
this.listener = this.props.firebase.auth.onAuthStateChanged(
authUser =>
authUser
? this.setState( authUser )
: this.setState( authUser: null );
,
);
componentWillUnmount()
this.listener();
render()
return (
<AuthUserContext.Provider value=this.state.authUser>
<Component ...this.props />
</AuthUserContext.Provider>
);
return withFirebase(WithAuthentication);
;
export default withAuthentication;
However I am looking to use the new React
Hooks
to remove the need for HOCs
. I have already removed the withFirebase()
HOC
by using the React Context
and useContext(FirebaseContext)
to access a single instance of Firebase
. Is there a way using the new hooks
to mimic this withAuthentication
HOC
within components
that I create?
I am using this tutorial
https://www.robinwieruch.de/complete-firebase-authentication-react-tutorial/
The section titled "Session Handling with Higher-Order Components" contains this part.
Thanks!
reactjs firebase firebase-authentication react-hooks
add a comment |
I am using Firebase
to authenticate users for my application. I have created the SignIn
and SignUp
forms and can successfully create new users and sign in with stored users. However the issue comes with maintaining the user logged in state after a Reload
.
The way I have seen it done in tutorials is to use a HOC
like the following to check if the current user is logged in.
const withAuthentication = Component =>
class WithAuthentication extends React.Component
constructor(props)
super(props);
this.state =
authUser: null,
;
componentDidMount()
this.listener = this.props.firebase.auth.onAuthStateChanged(
authUser =>
authUser
? this.setState( authUser )
: this.setState( authUser: null );
,
);
componentWillUnmount()
this.listener();
render()
return (
<AuthUserContext.Provider value=this.state.authUser>
<Component ...this.props />
</AuthUserContext.Provider>
);
return withFirebase(WithAuthentication);
;
export default withAuthentication;
However I am looking to use the new React
Hooks
to remove the need for HOCs
. I have already removed the withFirebase()
HOC
by using the React Context
and useContext(FirebaseContext)
to access a single instance of Firebase
. Is there a way using the new hooks
to mimic this withAuthentication
HOC
within components
that I create?
I am using this tutorial
https://www.robinwieruch.de/complete-firebase-authentication-react-tutorial/
The section titled "Session Handling with Higher-Order Components" contains this part.
Thanks!
reactjs firebase firebase-authentication react-hooks
2
one option is to use the react-firebase-hooks library, which has support foronAuthStateChange
through itsuseAuthState
hook
– Jeff
Mar 27 at 0:01
Thanks Jeff, I did look into this, however I want to reduce the number of dependencies my project has as it will have minimal maintenance in future so I don't want to have to worry too much about breaking changes!
– Tristan Trainer
Mar 27 at 9:09
add a comment |
I am using Firebase
to authenticate users for my application. I have created the SignIn
and SignUp
forms and can successfully create new users and sign in with stored users. However the issue comes with maintaining the user logged in state after a Reload
.
The way I have seen it done in tutorials is to use a HOC
like the following to check if the current user is logged in.
const withAuthentication = Component =>
class WithAuthentication extends React.Component
constructor(props)
super(props);
this.state =
authUser: null,
;
componentDidMount()
this.listener = this.props.firebase.auth.onAuthStateChanged(
authUser =>
authUser
? this.setState( authUser )
: this.setState( authUser: null );
,
);
componentWillUnmount()
this.listener();
render()
return (
<AuthUserContext.Provider value=this.state.authUser>
<Component ...this.props />
</AuthUserContext.Provider>
);
return withFirebase(WithAuthentication);
;
export default withAuthentication;
However I am looking to use the new React
Hooks
to remove the need for HOCs
. I have already removed the withFirebase()
HOC
by using the React Context
and useContext(FirebaseContext)
to access a single instance of Firebase
. Is there a way using the new hooks
to mimic this withAuthentication
HOC
within components
that I create?
I am using this tutorial
https://www.robinwieruch.de/complete-firebase-authentication-react-tutorial/
The section titled "Session Handling with Higher-Order Components" contains this part.
Thanks!
reactjs firebase firebase-authentication react-hooks
I am using Firebase
to authenticate users for my application. I have created the SignIn
and SignUp
forms and can successfully create new users and sign in with stored users. However the issue comes with maintaining the user logged in state after a Reload
.
The way I have seen it done in tutorials is to use a HOC
like the following to check if the current user is logged in.
const withAuthentication = Component =>
class WithAuthentication extends React.Component
constructor(props)
super(props);
this.state =
authUser: null,
;
componentDidMount()
this.listener = this.props.firebase.auth.onAuthStateChanged(
authUser =>
authUser
? this.setState( authUser )
: this.setState( authUser: null );
,
);
componentWillUnmount()
this.listener();
render()
return (
<AuthUserContext.Provider value=this.state.authUser>
<Component ...this.props />
</AuthUserContext.Provider>
);
return withFirebase(WithAuthentication);
;
export default withAuthentication;
However I am looking to use the new React
Hooks
to remove the need for HOCs
. I have already removed the withFirebase()
HOC
by using the React Context
and useContext(FirebaseContext)
to access a single instance of Firebase
. Is there a way using the new hooks
to mimic this withAuthentication
HOC
within components
that I create?
I am using this tutorial
https://www.robinwieruch.de/complete-firebase-authentication-react-tutorial/
The section titled "Session Handling with Higher-Order Components" contains this part.
Thanks!
reactjs firebase firebase-authentication react-hooks
reactjs firebase firebase-authentication react-hooks
edited Mar 27 at 2:15
Frank van Puffelen
267k33 gold badges430 silver badges455 bronze badges
267k33 gold badges430 silver badges455 bronze badges
asked Mar 26 at 21:17
Tristan TrainerTristan Trainer
4123 silver badges16 bronze badges
4123 silver badges16 bronze badges
2
one option is to use the react-firebase-hooks library, which has support foronAuthStateChange
through itsuseAuthState
hook
– Jeff
Mar 27 at 0:01
Thanks Jeff, I did look into this, however I want to reduce the number of dependencies my project has as it will have minimal maintenance in future so I don't want to have to worry too much about breaking changes!
– Tristan Trainer
Mar 27 at 9:09
add a comment |
2
one option is to use the react-firebase-hooks library, which has support foronAuthStateChange
through itsuseAuthState
hook
– Jeff
Mar 27 at 0:01
Thanks Jeff, I did look into this, however I want to reduce the number of dependencies my project has as it will have minimal maintenance in future so I don't want to have to worry too much about breaking changes!
– Tristan Trainer
Mar 27 at 9:09
2
2
one option is to use the react-firebase-hooks library, which has support for
onAuthStateChange
through its useAuthState
hook– Jeff
Mar 27 at 0:01
one option is to use the react-firebase-hooks library, which has support for
onAuthStateChange
through its useAuthState
hook– Jeff
Mar 27 at 0:01
Thanks Jeff, I did look into this, however I want to reduce the number of dependencies my project has as it will have minimal maintenance in future so I don't want to have to worry too much about breaking changes!
– Tristan Trainer
Mar 27 at 9:09
Thanks Jeff, I did look into this, however I want to reduce the number of dependencies my project has as it will have minimal maintenance in future so I don't want to have to worry too much about breaking changes!
– Tristan Trainer
Mar 27 at 9:09
add a comment |
1 Answer
1
active
oldest
votes
You can write a Custom Hook
which registers an effect and returns the auth state
const useFirebaseAuthentication = (firebase) =>
const [authUser, setAuthUser] = useState(null);
useEffect(() =>
const unlisten = firebase.auth.onAuthStateChanged(
authUser =>
authUser
? setAuthUser(authUser)
: setAuthUser(null);
,
);
return () =>
unlisten();
);
return authUser
export default useFirebaseAuthentication;
and in any Component
you can use it like
const MyComponent = (props) =>
const firebase = useContext(FirebaseContext);
const authUser = useFirebaseAuthentication(firebase);
return (...)
Index.jsx
will have this code in it
ReactDOM.render(
<FirebaseProvider>
<App />
</FirebaseProvider>,
document.getElementById('root'));
This Firebase Provider is defined like this,
import Firebase from './firebase';
const FirebaseContext = createContext();
export const FirebaseProvider = (props) => (
<FirebaseContext.Provider value=new Firebase()>
props.children
</FirebaseContext.Provider>
);
Beginner Question , am following the same tutorial . How did you write useContext(FirebaseContext) function .Can you please share the code if possible. Also how do you apply it if it is not similar to the provided in the tutorials . Thanks
– 1nullpointer
May 7 at 11:35
1
@1nullpointer, useContext is a hook provided by react out of the box which you can use by importing likeimport useContext from 'react';
– Shubham Khatri
May 7 at 11:47
1
@1nullpointer You will use useContext in components where you haveFirebaseContext.Consumer
in render of HOC.
– Shubham Khatri
May 7 at 12:03
1
yes, you just need usecontext and that return you what the render prop of FirebaaseContext.Consumer returns in callback
– Shubham Khatri
May 7 at 12:16
1
You can craete a custom hook that calls these two hooks and returns the result, much like you did foruseFirebaseAuthentication
– Shubham Khatri
May 9 at 5:52
|
show 6 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366320%2fhow-do-i-use-the-firebase-onauthstatechange-with-the-new-react-hooks%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can write a Custom Hook
which registers an effect and returns the auth state
const useFirebaseAuthentication = (firebase) =>
const [authUser, setAuthUser] = useState(null);
useEffect(() =>
const unlisten = firebase.auth.onAuthStateChanged(
authUser =>
authUser
? setAuthUser(authUser)
: setAuthUser(null);
,
);
return () =>
unlisten();
);
return authUser
export default useFirebaseAuthentication;
and in any Component
you can use it like
const MyComponent = (props) =>
const firebase = useContext(FirebaseContext);
const authUser = useFirebaseAuthentication(firebase);
return (...)
Index.jsx
will have this code in it
ReactDOM.render(
<FirebaseProvider>
<App />
</FirebaseProvider>,
document.getElementById('root'));
This Firebase Provider is defined like this,
import Firebase from './firebase';
const FirebaseContext = createContext();
export const FirebaseProvider = (props) => (
<FirebaseContext.Provider value=new Firebase()>
props.children
</FirebaseContext.Provider>
);
Beginner Question , am following the same tutorial . How did you write useContext(FirebaseContext) function .Can you please share the code if possible. Also how do you apply it if it is not similar to the provided in the tutorials . Thanks
– 1nullpointer
May 7 at 11:35
1
@1nullpointer, useContext is a hook provided by react out of the box which you can use by importing likeimport useContext from 'react';
– Shubham Khatri
May 7 at 11:47
1
@1nullpointer You will use useContext in components where you haveFirebaseContext.Consumer
in render of HOC.
– Shubham Khatri
May 7 at 12:03
1
yes, you just need usecontext and that return you what the render prop of FirebaaseContext.Consumer returns in callback
– Shubham Khatri
May 7 at 12:16
1
You can craete a custom hook that calls these two hooks and returns the result, much like you did foruseFirebaseAuthentication
– Shubham Khatri
May 9 at 5:52
|
show 6 more comments
You can write a Custom Hook
which registers an effect and returns the auth state
const useFirebaseAuthentication = (firebase) =>
const [authUser, setAuthUser] = useState(null);
useEffect(() =>
const unlisten = firebase.auth.onAuthStateChanged(
authUser =>
authUser
? setAuthUser(authUser)
: setAuthUser(null);
,
);
return () =>
unlisten();
);
return authUser
export default useFirebaseAuthentication;
and in any Component
you can use it like
const MyComponent = (props) =>
const firebase = useContext(FirebaseContext);
const authUser = useFirebaseAuthentication(firebase);
return (...)
Index.jsx
will have this code in it
ReactDOM.render(
<FirebaseProvider>
<App />
</FirebaseProvider>,
document.getElementById('root'));
This Firebase Provider is defined like this,
import Firebase from './firebase';
const FirebaseContext = createContext();
export const FirebaseProvider = (props) => (
<FirebaseContext.Provider value=new Firebase()>
props.children
</FirebaseContext.Provider>
);
Beginner Question , am following the same tutorial . How did you write useContext(FirebaseContext) function .Can you please share the code if possible. Also how do you apply it if it is not similar to the provided in the tutorials . Thanks
– 1nullpointer
May 7 at 11:35
1
@1nullpointer, useContext is a hook provided by react out of the box which you can use by importing likeimport useContext from 'react';
– Shubham Khatri
May 7 at 11:47
1
@1nullpointer You will use useContext in components where you haveFirebaseContext.Consumer
in render of HOC.
– Shubham Khatri
May 7 at 12:03
1
yes, you just need usecontext and that return you what the render prop of FirebaaseContext.Consumer returns in callback
– Shubham Khatri
May 7 at 12:16
1
You can craete a custom hook that calls these two hooks and returns the result, much like you did foruseFirebaseAuthentication
– Shubham Khatri
May 9 at 5:52
|
show 6 more comments
You can write a Custom Hook
which registers an effect and returns the auth state
const useFirebaseAuthentication = (firebase) =>
const [authUser, setAuthUser] = useState(null);
useEffect(() =>
const unlisten = firebase.auth.onAuthStateChanged(
authUser =>
authUser
? setAuthUser(authUser)
: setAuthUser(null);
,
);
return () =>
unlisten();
);
return authUser
export default useFirebaseAuthentication;
and in any Component
you can use it like
const MyComponent = (props) =>
const firebase = useContext(FirebaseContext);
const authUser = useFirebaseAuthentication(firebase);
return (...)
Index.jsx
will have this code in it
ReactDOM.render(
<FirebaseProvider>
<App />
</FirebaseProvider>,
document.getElementById('root'));
This Firebase Provider is defined like this,
import Firebase from './firebase';
const FirebaseContext = createContext();
export const FirebaseProvider = (props) => (
<FirebaseContext.Provider value=new Firebase()>
props.children
</FirebaseContext.Provider>
);
You can write a Custom Hook
which registers an effect and returns the auth state
const useFirebaseAuthentication = (firebase) =>
const [authUser, setAuthUser] = useState(null);
useEffect(() =>
const unlisten = firebase.auth.onAuthStateChanged(
authUser =>
authUser
? setAuthUser(authUser)
: setAuthUser(null);
,
);
return () =>
unlisten();
);
return authUser
export default useFirebaseAuthentication;
and in any Component
you can use it like
const MyComponent = (props) =>
const firebase = useContext(FirebaseContext);
const authUser = useFirebaseAuthentication(firebase);
return (...)
Index.jsx
will have this code in it
ReactDOM.render(
<FirebaseProvider>
<App />
</FirebaseProvider>,
document.getElementById('root'));
This Firebase Provider is defined like this,
import Firebase from './firebase';
const FirebaseContext = createContext();
export const FirebaseProvider = (props) => (
<FirebaseContext.Provider value=new Firebase()>
props.children
</FirebaseContext.Provider>
);
edited May 8 at 11:01
answered Mar 27 at 5:18
Shubham KhatriShubham Khatri
112k23 gold badges152 silver badges192 bronze badges
112k23 gold badges152 silver badges192 bronze badges
Beginner Question , am following the same tutorial . How did you write useContext(FirebaseContext) function .Can you please share the code if possible. Also how do you apply it if it is not similar to the provided in the tutorials . Thanks
– 1nullpointer
May 7 at 11:35
1
@1nullpointer, useContext is a hook provided by react out of the box which you can use by importing likeimport useContext from 'react';
– Shubham Khatri
May 7 at 11:47
1
@1nullpointer You will use useContext in components where you haveFirebaseContext.Consumer
in render of HOC.
– Shubham Khatri
May 7 at 12:03
1
yes, you just need usecontext and that return you what the render prop of FirebaaseContext.Consumer returns in callback
– Shubham Khatri
May 7 at 12:16
1
You can craete a custom hook that calls these two hooks and returns the result, much like you did foruseFirebaseAuthentication
– Shubham Khatri
May 9 at 5:52
|
show 6 more comments
Beginner Question , am following the same tutorial . How did you write useContext(FirebaseContext) function .Can you please share the code if possible. Also how do you apply it if it is not similar to the provided in the tutorials . Thanks
– 1nullpointer
May 7 at 11:35
1
@1nullpointer, useContext is a hook provided by react out of the box which you can use by importing likeimport useContext from 'react';
– Shubham Khatri
May 7 at 11:47
1
@1nullpointer You will use useContext in components where you haveFirebaseContext.Consumer
in render of HOC.
– Shubham Khatri
May 7 at 12:03
1
yes, you just need usecontext and that return you what the render prop of FirebaaseContext.Consumer returns in callback
– Shubham Khatri
May 7 at 12:16
1
You can craete a custom hook that calls these two hooks and returns the result, much like you did foruseFirebaseAuthentication
– Shubham Khatri
May 9 at 5:52
Beginner Question , am following the same tutorial . How did you write useContext(FirebaseContext) function .Can you please share the code if possible. Also how do you apply it if it is not similar to the provided in the tutorials . Thanks
– 1nullpointer
May 7 at 11:35
Beginner Question , am following the same tutorial . How did you write useContext(FirebaseContext) function .Can you please share the code if possible. Also how do you apply it if it is not similar to the provided in the tutorials . Thanks
– 1nullpointer
May 7 at 11:35
1
1
@1nullpointer, useContext is a hook provided by react out of the box which you can use by importing like
import useContext from 'react';
– Shubham Khatri
May 7 at 11:47
@1nullpointer, useContext is a hook provided by react out of the box which you can use by importing like
import useContext from 'react';
– Shubham Khatri
May 7 at 11:47
1
1
@1nullpointer You will use useContext in components where you have
FirebaseContext.Consumer
in render of HOC.– Shubham Khatri
May 7 at 12:03
@1nullpointer You will use useContext in components where you have
FirebaseContext.Consumer
in render of HOC.– Shubham Khatri
May 7 at 12:03
1
1
yes, you just need usecontext and that return you what the render prop of FirebaaseContext.Consumer returns in callback
– Shubham Khatri
May 7 at 12:16
yes, you just need usecontext and that return you what the render prop of FirebaaseContext.Consumer returns in callback
– Shubham Khatri
May 7 at 12:16
1
1
You can craete a custom hook that calls these two hooks and returns the result, much like you did for
useFirebaseAuthentication
– Shubham Khatri
May 9 at 5:52
You can craete a custom hook that calls these two hooks and returns the result, much like you did for
useFirebaseAuthentication
– Shubham Khatri
May 9 at 5:52
|
show 6 more comments
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55366320%2fhow-do-i-use-the-firebase-onauthstatechange-with-the-new-react-hooks%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
one option is to use the react-firebase-hooks library, which has support for
onAuthStateChange
through itsuseAuthState
hook– Jeff
Mar 27 at 0:01
Thanks Jeff, I did look into this, however I want to reduce the number of dependencies my project has as it will have minimal maintenance in future so I don't want to have to worry too much about breaking changes!
– Tristan Trainer
Mar 27 at 9:09