title: How to change background color in paragraph depending on the values reactjs
body: <p>I want to change background color with check if <code>{this.state.list[0].main.temp}</code> &gt; 10 background color of this paragraph to be yellow ..</p>
  <p>Code:</p>
  <pre><code>const getBackground = (temperature) =&gt; {
      if(temperature &gt; 30) return &quot;red&quot;
      if(temperature &gt; 20) return &quot;orange&quot;
      if(temperature &gt; 10) return &quot;yellow&quot;
      return &quot;transparent&quot;
    }
    
    renderForecast1 = () =&gt; {
      if (this.state &amp;&amp; this.state.list) {
        const list = this.state.list[0];
        return (
          &lt;p style={{ backgroundColor: getBackground(list.main.temp) }}&gt;
            Date: {list.dt_txt}h &lt;br /&gt;
            Temperature: {list.main.temp} °C &lt;br /&gt;
            Chance of precipitation: {list.pop} mm &lt;br /&gt;
            Wind Speed: {Math.round(list.wind.speed, 1) * 3.6} km/h &lt;br /&gt;
            Pressure: {list.main.pressure} hPa &lt;br /&gt;
            Humidity: {list.main.humidity} %
          &lt;/p&gt;
        );
      }
    };
  </code></pre>
  <p>I receive error:</p>
  <pre><code> SyntaxError: C:\Users\Admin\Desktop\weather\weather\src\App.js: Unexpected token (86:8)
  
    84 |   };
    85 |
  &gt; 86 |   const getBackground = (temperature) =&gt; {
       |         ^
    87 |     if(temperature &gt; 30) return &quot;red&quot;
    88 |     if(temperature &gt; 20) return &quot;orange&quot;
    89 |     if(temperature &gt; 10) return &quot;yellow&quot;
  </code></pre>
  <p>How to do that ?</p>