title: React how to dynamically set div height to follow suit of full window height including scroll
body: <p>I'm making a react redux app.</p>
  
  <p>My view gets bigger as I add elements (or smaller as I remove them) but I can't get my background to follow suit correctly.</p>
  
  <p>I've tried using scrollHeight to determine the size it should have :</p>
  
  <p><a href="https://i.imgur.com/HGHJgub.gifv" rel="noreferrer">https://i.imgur.com/HGHJgub.gifv</a></p>
  
  <p>Here is my code :</p>
  
  <pre><code>constructor(props) {
      super(props);
      this.state = {
          heightSet: 0,
      };
      this.updateDimensions = this.updateDimensions.bind(this);
  }
  
  componentDidMount() {
      this.updateDimensions();
      window.addEventListener('resize', this.updateDimensions);
  }
  
  componentWillUnmount() {
      window.removeEventListener('resize', this.updateDimensions);
  }
  
  updateDimensions() {
      this.setState({ heightSet: document.body.scrollHeight });
      console.log(document.body.scrollHeight);
  }
  
  render() {
      const divStyle = {
          height: this.state.heightSet + 'px',
      };
      return (
          &lt;div style={divStyle}&gt;
          &lt;/div&gt;
      )
  }
  </code></pre>
  
  <p>but All of this is clearly to be ditched. 
  I'm not taking the right approach.
  It also touches on another issue of my app :
  It knows to add height to the view but not to remove it.
  Anybody know why it has this behavior and how to remedy it?</p>
  
  <p>UPDATE : </p>
  
  <p>CLARIFICATION the real issue is that this solution doesn't have any update on the var when I click "add  component" and my scroll height increases.
  all in all the above solution is utter garbage.
  I like this idea  : <a href="https://stackoverflow.com/questions/30640446/set-color-for-extra-page-parts-visible-during-rubber-band-scroll">Set color for extra page parts visible during rubber band scroll</a>  (yeah it's a hack but that's fine by me)</p>
  
  <p>from Shishir Arora and tksb</p>
  
  <p>but it seems it does not work on modern browsers (at least not Chrome and latest Chrome is target N°1 for my app).</p>