Questions tagged [react-cookie]

72 questions
0
votes
1 answer

React-cookies with hooks

i'm using React-cookies, redux, redux-thunk and hooks. I don't understand how to store the value of " token " as a cookie. this is the Component App.js
Legeo
  • 784
  • 4
  • 20
  • 44
0
votes
1 answer

In-component data fetching depending on cookie

I have a component like this: class MyComponent extends React.PureComponent { componentDidMount() { const { params } = this.props.match fetch(`/o/${params.id}`, { headers: { 'Accept': 'application/json', …
Karol Selak
  • 4,248
  • 6
  • 35
  • 65
0
votes
1 answer

"Maximum update depth exceeded" error in react and react-cookie

I implemented a simple Login Form in React with Redux following this tutorial: https://jslancer.com/blog/2017/04/27/a-simple-login-flow-with-react-and-redux/ Everything works, but when I add cookies I get the error: Warning: Cannot update during an…
0
votes
1 answer

React-cookie: Invariant Violation: The root route must render a single element

I'm using react-cookie package, when I try to set it up at the highest level component, it will throw me these errors: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite…
Jee Mok
  • 6,157
  • 8
  • 47
  • 80
0
votes
1 answer

REACT: Component state isn't being updated when it's loaded from a cookie

I have a React application with a button that features a toogle, this toggle allows to show or hide some views in the page, therefore if the user hits the toogle button it will see one view (Toggle ON View) or the other (Toggle OFF View). I have to…
0
votes
1 answer

Getting warning when i use withCookies()

I am using react-cookie in my project. When i use withCookies() i am getting warning in console log like this Warning: Failed prop type: Invalid prop component of type object supplied to Route, expected function How can i solve this.? Below is…
Sudeep Kumar
  • 839
  • 1
  • 7
  • 16
0
votes
0 answers

conditional check not working as expected in react component

I am designing the header to display login and logout button based on auth status and I am using react-cookie to store the auth status Component Code import React, { Component } from "react"; import { Link } from "react-router-dom"; import {…
Dhaval Chheda
  • 4,637
  • 5
  • 24
  • 44
0
votes
1 answer

React-cookie extension doesnt work / Element type is invalid

I'm unable to use react-cookie module in my application, for some reason it gives me the following error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check…
AnKing
  • 1,994
  • 6
  • 31
  • 54
0
votes
2 answers

does reactjs have session or cookie for user profile?

I know React is client side, but does it have session or cookie to send it to server with Axios for cart and user profile? I found react-cookie but, is it secure?
0
votes
1 answer

Cookie doesn't accepting all my items into its array

I have a cookie for a cart, but when I try to add another item to the array that is stored inside, it seems to ignore it here's the code: const { cookies } = this.props; var cart = cookies.get('cart')?cookies.get('cart'):[]; var itemIndex =…
SirSoDerp
  • 51
  • 1
  • 7
-1
votes
1 answer

export 'default' (imported as 'Cookies') was not found in 'react-cookie' (possible exports unknown)

I am getting above error while trying to access cookie from browser using 'react-cookie'. Here is the code i am trying: import Cookies from 'react-cookie'; function App() { const { currentUser } = useContext(AuthContext); …
-1
votes
2 answers

How can i set a cookie of an object with fields using react-cookies

I am trying to set the value of a cookie from data that I have loaded from a json (will come from axios call in the functional app). Here is a link to the codesandbox. If you want to look through the code here is the data.JSON: { "accounts": [ { …
Say u
  • 129
  • 11
1 2 3 4
5