score:1
Accepted answer
you must json.stringify your data while using sessionstorage.setitem and json.parse while reading it.
also, in your mapstatetoprops, you have this:
return {
token: state.auth.token
};
};
but this is how your state looks like: state = { token: 'value' }
make sure you have the same structure.
Source: stackoverflow.com
Related Query
- On Register, User is created in the database, but JWT token is "undefined" when inspect in browser
- jwt token how to ensure the payload is updated when database change
- React useState sets response from database but when I try to access the data[0].listing_reviews it returns an undefined error
- React TypeScript callback reading undefined when using setState, but it will log the value
- So i created a Callback function in React and i am invoking it but it keeps in showing the error that its undefined
- I want to display a div when user hover over a sign in element but div should be displayed when user moves the mouse to that div other in ReactJS
- state is undefined when using useContext but not undefined in the provider
- I can print a state object array, but when I try to access a value from an object in the array, the whole object is undefined
- Access Token in React.useEffect generally works, but comes back undefined when page is refreshed / reloaded
- How to get user information from database when the only thing in client browser is the AuthToken?
- I am trying to map mydata from the database but i am getting this error. TypeError: Cannot read property 'map' of undefined
- Logging out the user when token has expired - react redux
- When the user logs in, logout button must show, but it's not showing instantly. Why is it happening?
- my react code is working but when i refresh the page i get TypeError: Cannot read property 'Location' of undefined
- React - get request is getting the correct object but when read into react component the value is undefined
- How do I handle undefined state in react when the user hits cancel on file selection?
- Trying to show card details when a user clicks on a card but receiving "not defined" error for the props I am passing in
- Token is correct in frontend, but in the backend it's undefined
- Is there anyway to authenticate the user type(user and Supplier) without any token in react and go with different page when I fetch the response api?
- GraphQL query returns undefined but works fine when I refresh the page?
- this.setState not updating nested array in user object, but when console.loging the same logic, it returns a correct looking object
- socket connect event inside useEffect does not work when component is created but works after refreshing the page in React
- How do I forward authorization with the user JWT token in the header and compare it to the JWT token in the cookie to Auth user?
- Why is "this" keyword undefined when invoked by inline event handler in React, but it refers to the caller when invoked by post-render event listener?
- when I type my react js component it is doing well but when i reload the browser it gives me error Cannot read property 'value' of undefined
- When I register I cannot see the user name until I refresh or login
- what is the best way to check user logged in or not when using token login in reactjs
- Want to send JWT token in headers along with data using axios but getting this error : Cannot set headers after they are sent to the client
- Cannot read property 'data' of undefined when user successfully register
- I am trying to confirm the user through the token but its showing an error
More Query from same tag
- How do I display on frontend the result of "methods.name.call()" web3 - method
- IE 11, Data from server not update
- React.js: Pass value from form to axios POST request
- Delay in filter input basic reactJS search function
- React/Redux Component will not render
- How to update a single property of the state in a react hook?
- Force scroll down to a particular point after some user scrolling [React]
- Run script to show alert and redirect on IE before error kicks in in Gatsby
- Setting multiple parameters on breakpoint in MUI v5
- Issue using useRef with TypeScript
- Cannot display images in my JSX from my array.map in my react app even though .map loops though all index of array
- Webpack Hot module replacement, react 18 ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before
- Firebase callable function for Twilio token creation with React
- how to not focus on the search bar when the shortcut key is pressed in the textarea in react?
- if(this.isMounted()) not being called?
- How to test different screen widths using Jest
- ReactJS & Typescript: Creating a private route using router dom
- How can I delete Multiple array items
- VS Code autocomplete/intellisense not working
- How to avoid the "Z" in my PostgreSQL datetime
- How do I render component based on state
- Extend leaflet with plugin on specific leaflet version
- onScroll in react only works on the window?
- In React, why route can work properly without path
- react-d3-tree error parsing external JSON
- Having trouble calling function in parent from child in react
- Redirect automatically from one component to another one after few seconds - react
- Using Map and Sort to show the objects that contains URL of images with the timestamps
- Calling an exported function by a string value of the function name
- Multi Page application React Router v4