Download local storage first

I have a response application, for example, where I have one App.js, which includes mine Headersand Footers..

There I save mine statein local storage. After saving, I can restore it ..

But I have a problem loading. In my browser, when I do localstorage['key'], it gives me data, but I can’t load it.

Where should I download it first?

I have Root.js:

class Root extends Component {
  render() {
    const { store } = this.props
    return (
      <Provider store={store}>
          <ReduxRouter />
      </Provider>
    )
  }
}

Root.propTypes = {
  store: PropTypes.object.isRequired
}

export default Root

and index.jsat the external level:

const store = configureStore()


render(

    <Root store={store} />,
  document.getElementById('root')
)

Where should I upload mine localStorage?

Help is needed. I need to know what is called the first in the reaction so that I can call to load localStoragethere .. If this is not a bad idea

+4
2

redux, .

:

  • ReduxRouter . . docs
  • componentDidMount, getStuffFromLocalstorage. .
  • , localStorage,

, , , , .

+1

Source: https://habr.com/ru/post/1629335/


All Articles