title: How to get the attribute in react without component
body: <p>How to get the attribute <code>data-digit</code> and the class <code>gauge, gauge-outer, gauge-inner and gauge-digits</code></p>
  <p><em><strong>TSX</strong></em></p>
  <pre><code>import React from 'react';
  import style from './gauge.module.scss';
  
  
  const Gauge = (props) =&gt; {
      const points = 43;
      const radius = 257;
      const max = 100;
      const peaks = [10, 50, 90];
      const step = (max + 1) / points;
      const realPeaks = peaks.map(peak =&gt; Math.floor(peak * (1 / step)));
      const hueStep = 120 / points;
  
      return (
          &lt;&gt;
              &lt;div className={style['gauge']} data-digit={50}&gt;       
                  &lt;div className={style['gauge-outer']}&gt;&lt;/div&gt;
                  &lt;div className={style['gauge-inner']}&gt;&lt;/div&gt;
                  &lt;div className={style['gauge-digits']}&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/&gt;
      )
  }
  
  export default Gauge;
  </code></pre>
  <p>I added this code below the const hueStep.</p>
  <pre><code> const gaugeDigits = document.getElementsByClassName('gauge-digits');
      console.log(gaugeDigits)
  </code></pre>
  <p>But it doesn't work, the error: document is undefined</p>