title: React: Adding CSS classes to body tag
body: <p>Was wondering whether there is an easier way to add classes to the body tag.</p>
  
  <p><a href="https://i.stack.imgur.com/aFq3j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aFq3j.png" alt="enter image description here"></a></p>
  
  <p>Currently I am doing something like this in
   the MainComponent </p>
  
  <pre><code>const MAIN_CLASSES = [ three-col, darkTheme, blueHeader, .... etc]
  
  class MainComponent extends React.Component {
    componentDidMount() {
      document.body.classList.add(...MAIN_CLASSES);   
    }
  
    componentWillUnmount() {
     document.body.classList.remove(...MAIN_CLASSES);
    }
  
    render() ....
  }
  </code></pre>
  
  <p>Interested to know what others are doing thank you!</p>