title: Where to set state when I need that state in render?
body: <p>I am getting this error below:</p>
  <pre><code>react_devtools_backend.js:2430 Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.
  </code></pre>
  <p>From the error, I know I am getting it because I am setting state in the render.</p>
  <p>But I am not sure where to set the state because I need that state element, <code>developerTitle</code> further down inside the render method.</p>
  <p>Where can I put it if not in render?</p>
  <p>Thanks!</p>
  <p>Here is my code:</p>
  <pre><code>export default class Game extends React.PureComponent {
      constructor(props) {
          super(props);
  
          this.state = {
              developerTitle: ''
          }
      }
  
      render() {
          const { indieDeveloperId } = this.props;
          this.setState({ developerTitle: this.getDeveloperTitle(game.indieDeveloperId) });
          
              &lt;div&gt;
  
                  &lt;h3&gt;{this.state.developerTitle}&lt;/h3&gt;
                  ...
                  ...
              &lt;/div&gt;
      }
      
      //by-indie-developer/{indieDeveloperId
      async getDeveloperTitle(indieDeveloperId) {
          const r = await axios.get(`/api/developer/by-indie-developer/${indieDeveloperId}`);
          const developerTitle = r.data;
          this.setState({
              ...this.state, ...{
                  developerTitle: developerTitle
              }
          });
      }
  }
  </code></pre>