score:1
Accepted answer
from your edit, it looks like what console.log
is showing is actually a string
. so, doing a json.decode
on what cookies.get
is returning should do the trick:
const favourites = json.decode(cookies.get('favourites'));
Source: stackoverflow.com
Related Query
- useEffect with async and Cookies.get in NextJS
- How to test useEffect with async function and setState inside
- React error boundaries with useEffect and async function, what I'm missing?
- Can't get cookies with js-cookie and react
- fetching data in React with DynamicRoutes, nextJS and useEffect
- How to do a custom logic and redirect to another pages in react or nextjs with useEffect hook
- paste token in useReducer with useContext in nextjs and get undefined
- Why my useEffect that tries to get blockchain data is looping infinitely and my async func still returns Promise pending
- Unit Testing with Jest and React - Axios Get Inside useEffect
- Explanation needed: getting data from API with useEffect hook and get name
- react get data from rest api with axios and and useEffect redering empty array plus array with data
- Async with useEffect and loading data into variables
- Get selection from controlled MUI Autocomplete with async data and react-hook-form
- ReactJs can't get async content form api call in useEffect and use it later in component
- Async validation with Formik, Yup and React
- Cannot read property '.then' of undefined when testing async action creators with redux and react
- Using async and await with export const
- Handling async request with React, Redux and Axios?
- Testing with React's Jest and Enzyme when async componentDidMount
- react-router-dom get id from route with custom components and extra path
- How to translate routes with NextJS and next-i18next?
- Difference between with and without useEffect in react functional component
- How do you deal with public and private routes in a NextJS app?
- React with NextJS and Next-CSS: You may need an appropriate loader to handle this file type
- using google fonts in nextjs with sass, css and semantic ui react
- How to send body data and headers with axios get request?
- Async Image Load with React and Redux
- Unable to get fetch-mock working with webpack and redux-react
- Difference between code inside useEffect with no dependencies and outside of it?
- In Visual Studio 2012, I get warnings and squiggly lines when trying to write JSX with React JS
More Query from same tag
- How to test onClick functionality which is present in parent component (arrow function)?
- How to properly use ref with a React class component and styled-components?
- Rendered more hooks than during the previous render in NextJS using GraphQL
- Hitting Back button in React app doesn't reload the page
- Reactjs : Getting active element name from <ul> in to the header
- react intl remove error logs and list keys
- React - convert date with date-fns
- how to align a grid item center in material-ui in react?
- How to properly implement "isLoading" in a parent component
- React Bootstrap component (Form.Control) OnChange event listener doesn't fire when select all text and delete
- Update specific object value contained within an array of objects in React
- Loop through complex react state to remove all empty strings
- Is it better practice to conditionally render in React or conditionally add a class to hide elements
- How to dispatch an action when component did mount using Hooks in a connected function component?
- React Router v4 and htaccess with wordpress
- I wants to build my react app but getting Error TypeError: MiniCssExtractPlugin is not a constructor at module.exports
- How to add insert objects by id
- React Routing gives Unexpected Token Error
- Trying to get the data(of mongodb) to the client side for the specific field (data.site.alerts.alert)
- How to add touch-enabled lightbox features to [react-slick]?
- Pass text value to another component
- Tmp array not properly added to state variable - React - Hooks
- Custom HTML Button wrapped in Link not working
- checkBox once at the time in React
- After editing only one field is edited and the other one behaves unexpectedly (React hooks)
- How to open one instead of all divs created using .map()
- REACT JS: Dynamically convert part of paragraph into an anchor tag and on click of that anchor tag do an API call before doing a redirect
- React multiple useEffect with useCallback
- How to stop making api call on re-rendering in React?
- Conditional property in react/jsx