question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

isomorphic support: localStorage is not defined

See original GitHub issue
Failed to retrieve initialize state from localStorage: ReferenceError: localStorage is not defined
    at /Users/azz0r/Sites/mobile-presales/node_modules/redux-localstorage/lib/persistState.js:59:38
    at /Users/azz0r/Sites/mobile-presales/node_modules/redux/lib/applyMiddleware.js:38:19
    at createStore (/Users/azz0r/Sites/mobile-presales/node_modules/redux/lib/createStore.js:59:33)

Any work arounds? This doesn’t block redux-localstorage working but it leaves an initial error message in console.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
moimaelcommented, Feb 23, 2017

It is also a problem when running tests, because localStorage is not defined either.

2reactions
vicentedealencarcommented, Jul 11, 2016

I think a check for typeof localstorage === 'undefined' before using localstorage would fix that

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid getting error 'localStorage is not defined' on ...
Show activity on this post. I was using localStorage in my webApp to store data on client side. But when I've tried to...
Read more >
Handle localStorage if not defined (isomorphic) · Issue #13
The straightforward fix, I think, is to remove 'const defaultStorage = adapter(localStorage);' at the top of persistState.js and replace the ...
Read more >
How to avoid getting error 'localStorage is not defined' on ...
Coding example for the question How to avoid getting error 'localStorage is not defined' on server in ReactJS isomorphic app?-Reactjs.
Read more >
Node.js – How to avoid getting error 'localStorage is not ...
I was using localStorage in my webApp to store data on client side. But when I've tried to make the app isomorphic, this...
Read more >
Server Error: ReferenceError: (localstorage) is not defined
( Question in stackoverflow ). I have a category name stored in my localstorage. I understand that with nextjs, localstorage is only stored ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found