Skip to content
This repository has been archived by the owner on Sep 12, 2020. It is now read-only.

How are you accessing localStorage? #39

Open
dschinkel opened this issue May 29, 2017 · 1 comment
Open

How are you accessing localStorage? #39

dschinkel opened this issue May 29, 2017 · 1 comment

Comments

@dschinkel
Copy link

dschinkel commented May 29, 2017

Josh, I cloned this down. How are you getting access to localStorage? Is that from phantom? When I try that in my react project I get undefined so figure it's gotta be phantom (or I could use casper probably):

import 'babel-core/polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import Root from './containers/Root';
import configureStore from './store/configureStore';
import {loginUserSuccess} from './actions';

const target = document.getElementById('root');
const store = configureStore(window.__INITIAL_STATE__);

const node = (
    <Root store={store} />
);

let token = localStorage.getItem('token');
if (token !== null) {
    store.dispatch(loginUserSuccess(token));
}

ReactDOM.render(node, target);

@wiesson
Copy link

wiesson commented Nov 3, 2017

What kind of browser do you use? If you open the console and type localStorage or window.localStorage - what do you get?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants