title: Why does the setState not trigger a re-render?
body: <p>I'am trying to trigger a re-render to exclude my header and footer.</p>
  
  <p>When I log the page, it first triggers render > componentDidMount > render, so I would assume the page did update with the correct values, but it still shows the header/footer.</p>
  
  <pre><code>constructor() {
      super();
      this.state = {
        header: true,
        footer: true,
      };
    }
    componentDidMount() {
      if (window.location.pathname === '/404-page') {
        this.setState({ header: false, footer: false });
      } else if (window.location.pathname === '/form') {
        this.setState({ header: true, footer: false });
      } else if (window.location.pathname.length &gt; 6) {
        this.setState({ header: true, footer: false });
      }
    }
   render() {
      {header ? &lt;Header /&gt; : null}
   }
  </code></pre>
  
  <p>The result would be that the header/footer aren't there anymore.</p>