title: Set state of react component by using redux store
body: <p>How I can assign some values of redux store to my component local state? </p>
  
  <p>I should use redux actions to get data from API in my componentDidMount() method. Am I right? after getting data by redux   I want to set my component's state using the data from redux store.I got an error <em>this.props.article is undefined.</em>, but redux devtools shows that article object exists.</p>
  
  <p>Where I supposed to call <strong>this.setState()</strong> method ??? I tried to call it in <strong><em>componentWillRecieveProps</em></strong>() or <strong><em>componentDidUpdate</em></strong>() , but unsuccessfuly.
   Please any help.Thank you in advance.</p>
  
  <pre><code>import React, { Component, Fragment } from 'react';
  import { Typography,Spin } from 'antd';
  import {connect} from 'react-redux';
  import {getArticleDetails} from '../store/actions/articles';
  
  
  
  class ArticleEdit extends Component {
      articleID = this.props.match.params.articleID; 
      state={
  
          str:'initial'
      }
      onChange = (str) =&gt; {
          console.log('Content change:', str);
          this.setState({ str1:str });
  
        };
      componentDidMount(){
          this.props.getArticleDetails(this.articleID);// GET data from api
          this.setState({str:this.props.article.title});// returns undefined
  
      }
  
      render() {
          return (
              &lt;Fragment&gt;
                  {this.props.article===undefined?(&lt;Spin/&gt;):
                      (
                      &lt;div&gt;
                          &lt;div style={{marginRight:'500px'}}&gt;
                            &lt;Paragraph editable={{ onChange: this.onChange}}&gt;                          
                                 {this.state.str}
                            &lt;/Paragraph&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      )}    
              &lt;/Fragment&gt;
          )
      }
  }
  
  const mapStateToProps = state =&gt;({
      article: state.articleReducer.articles[0],    
  })
  
  export default connect(mapStateToProps,{getArticleDetails})(ArticleEdit);
  </code></pre>