title: React - constructor() and componentDidMount
body: <p>I am using Redux to create my pagination. My problem is, in <code>constructor</code> I ran a method that will parse the url and check if there is anything about pagination. Then it runs an action that will put the data in my store. It all runs smoothly.</p>
  
  <p>Then, I have the <code>componentDidMount</code> method when I run another action - fetching data. And there I use those props I have previously pushed. Unfortunately, the store is at its initial state.</p>
  
  <p>My (simplified) code:</p>
  
  <pre><code>class NewsList extends React.Component {
      constructor(props) {
          super(props);
  
          this.profile = document.getElementById('articles').getAttribute('data-profile');
  
          this.parseHash();
      }
  
      parseHash() {
          /* Method for parsing navigation hash
           ---------------------------------------- */
          const hash = window.location.hash.replace('#', '').split('&amp;');
  
          const data = {
              page: 1,
              offset: 0
          };
  
          // hash parsing
  
          this.props.setPagination(data);
      }
  
      componentDidMount() {
          this.loadNews();
          // If I use
          // setTimeout(() =&gt; { this.loadNews(); })
          // it works, but I feel this is hack-ish
      }
  
      loadNews() {
          this.props.update({
              current:  {page: this.props.NewsListReducer.current.page, offset: this.props.NewsListReducer.current.offset},
              next:     {page: this.props.NewsListReducer.next.page, offset: this.props.NewsListReducer.next.offset}
          });
      }
  }
  </code></pre>
  
  <p>When I <code>console.log(this.props.NewsListReducer)</code>, I am getting <code>undefined</code> for both <code>current</code> and <code>next</code> object, but when I use Redux DevTools, the data is there. What can I do?</p>