redux-react-session | : key : Simple Session API storage for Redux and React | Router library
kandi X-RAY | redux-react-session Summary
kandi X-RAY | redux-react-session Summary
Keep your session sync with your local storage and Redux :key:. Redux React Session provides an API that allows to manage sessions through the app, with authorization function for react-router and a persisted session.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of redux-react-session
redux-react-session Key Features
redux-react-session Examples and Code Snippets
Community Discussions
Trending Discussions on redux-react-session
QUESTION
My program was working just fine until I started working with 'react-redux'. Now I get a blank page on localhost and the console shows the error:
Uncaught TypeError: Found non-callable @@iterator
Here is my code:
store
...ANSWER
Answered 2022-Mar-13 at 13:30Looks like a duplicate of Found non-callable @@iterator in reactjs store
You're trying to apply the spread operator to an object in your store setup. Plain javascript objects are not iterable, which is why you're getting an error about a non-callable @@iterator.
QUESTION
I'm trying to update my user state for my log in flow. User is part of rootReducer. Session is also, but that state's reducer belongs to the redux-react-session library.
My login flow is: user visits page, enters username and password. User presses Log In form button. On submit, session calls to server and signs user in. During the sign in process, the dispatch for the user state runs.
But after it runs, the user state is what it was before. Sign in clearly succeeded. So session state is populated with new data, and user state is not. Logs throughout indicate that userReducer was called, and that the state it returns conforms to expectation. Is there some special way to connect the userReducer to the store, or update it? Failing code below.
Documentation I found doesn't show if it's necessary to treat rootReducer stores differently from non-combined stores. Also, the login flow relies on the same function to dispatch the two actions, so the issue must be somewhere in the userReducer or action.
Edit: supplied code falls through to default case when it hits userReducer. I confirmed this by setting the default case to supply a different email value. Why is userReducer not accepting the action type UserActions#userAdd returns? And at what point is userReducer even called?
Edit2: debugger placed in userReducer shows that dispatch action does initially reach 'ADD_USER' and returns the proper object, but it does the dispatch several times immediately after and somehow resets the user state just between loading a different page. Is this normal behavior?
...ANSWER
Answered 2020-May-13 at 19:20I figured it out. The project needed redux-persist so that the state data rehydrates from one page to the next. Session state has its own handling for this functionality.
Code for implementing with combineReducers and redux-react-session and redux-thunk below. I'm still working on refining the merge level.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redux-react-session
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