yelp-clone | Yelp clone for blog post at fullstackreact.com | Learning library
kandi X-RAY | yelp-clone Summary
kandi X-RAY | yelp-clone Summary
This repository is the main repo for the app discussed and built in great detail at the fullstackreact /blog. For an in-depth discussion, check out the post.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Retrieve details for a map of properties
- Search for places in a map
yelp-clone Key Features
yelp-clone Examples and Code Snippets
Community Discussions
Trending Discussions on yelp-clone
QUESTION
I have a UserContext.js file which holds all of the useContext hooks. a Nav.js that displays some user info and a "Sign in" OR "Sign out" button. a Profile.js that displays user info. App.js that holds components and useContext.
Whats happening is if i sign in with a user everything gets displayed and i can navigate to various pages and the user information stays displayed. If i click Sign Out from the nav menu all of the user information instead of displaying “No User Info” shows empty fields on all the pages. And the “Sign Out” button appears again. I think this is happening because the UserContextProvider thats wrapping all of my components in App.js are calling auth.signout from the toggleUser function every time i navigate to a different page ? could i extract the toggleUser function out of the scope of UserContextProvider ? Or is something else happening?
App.js
...ANSWER
Answered 2021-Nov-22 at 05:30If I had to venture a guess as to why users don't stay "logged out" it is because of the inner subscription in the useEffect
not being unsubscribed to as well. It can still update the user
state.
Ensure you also reset the currentUser
state to null when there'e a falsey userAuth
value in the onAuthStateChanged
callback.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install yelp-clone
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page