title: React. Cannot start function inside the getDerivedStateFromProps
body: <p>I cannot understand, why when I try to start the function <code>getTodosList</code> inside the <code>getDerivedStateFromProps</code> the method - it always retrun to me the <code>TypeError - Cannot read property 'getTodosList' of null</code>. </p>
  
  <p>Also after I start use the <code>getDerivedStateFromProps</code> - my function does not start in <code>componentDidMount</code> too...</p>
  
  <p>What is I'm doing wrong? (</p>
  
  <pre><code>import React, { Component } from 'react';
  import {Doughnut} from 'react-chartjs-2';
  
  class Chart extends Component {
      constructor(props) {
          super(props);
  
          this.state = {
              // some state...
      }
  
      getTodosList = (todos) =&gt; {
          console.log(todos);
          const all = [];
          const done = [];
  
          // some logic...
  
      }
  
      componentDidMount() {
          const { todos } = this.props.state.iteams;
          console.log('componentDidMount', todos);
  
          this.getTodosList(todos);
      }
  
      static getDerivedStateFromProps(nextProps, prevState) {
          const { todos } = nextProps.state.iteams;
          console.log(this.getTodosList, prevState.datasets, 'componentWillReceiveProps', todos);
  
          this.getTodosList(todos); // TypeError: Cannot read property 'getTodosList' of null
  
      }
  </code></pre>