title: How to pass a state to multiple other classes in React
body: <p>I started learning React approx. month ago and I'm very confused about the concept because its still something new to me(compared to my previous work in C++ and C).</p>
  
  <p>To quickly summarize I would like to know what is React's equivalent of C++ return form a function. How would I return value(or values) from a function(in my case class functions/states) and use it in my other components.</p>
  
  <p>I have made an simple script that changes background to simulate RGB light on mouse and I made it so the HSL color mode is applied to the background of the component. I would like to use this on multiple components,icons, etc on my page but it feels like there is a better way than importing all functions in three files making the work triple than requiered.</p>
  
  <pre class="lang-js prettyprint-override"><code>import React, { Component } from 'react'
  import './colorStrip.scss'
  
  
  class ColorStrip extends Component {
  
      constructor(props) {
          super(props)
  
          this.colorHue=10;
          this.colorSaturation=100;
          this.colorLightness=50;
  
          this.state = {
              color:"hsl(0,100%,50%)"
          }
  
          this.changeColor(1);
      } 
  
  
      changeColor = (speed) =&gt; {
  
          this.colorHue+=10*speed;
  
          if(this.colorHue&gt;=360)
              this.colorHue=0;
  
          this.setState({ 
              color : "hsl("+this.colorHue+","+this.colorSaturation+"%,"+this.colorLightness+"%)"
          })
  
  
          setTimeout(() =&gt; {this.changeColor(speed)},75)
      }
  
  
  
      render() {
          return (
              &lt;svg style={{backgroundColor:this.state.color}} className="strip"&gt;
              &lt;/svg&gt;
  
          )
      }
  }
  
  export default ColorStrip
  </code></pre>
  
  <p>So I would like to use this.state.color(or this.state.colorHue or any state) in three other SVG components on my page.</p>
  
  <p>I really looked some of the other answers but they were quite complex and requiered multiple returns which was confusing.</p>