B
B
bpGusar2018-09-04 08:53:50
JavaScript
bpGusar, 2018-09-04 08:53:50

How to pass value from LocalStorage to next.js in getInitialProps?

How in the _app.js file, in which the redax store is connected to the application, to getInitialProps pass the value from LocalStorage?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-09-04
@bpGusar

Are we talking about next.js and next-redux-wrapper? Use componentDidMount:

componentDidMount() {
  this.props.store.dispatch(someAction());
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question