title: In React, how to format a number with commas?
body: <p>My API is sending React integers like <code>10, 31312, 4000</code>.</p>
  
  <p>In my React component, what's the right way to format these numbers like so:</p>
  
  <pre><code>from: 10, 31312, 4000
  to: 10, 31,312, 4,000
  </code></pre>
  
  <h2>Update</h2>
  
  <p>The number is being provided by my Rails API and rendered in a React component:</p>
  
  <pre><code>const RankingsList = ({rankings, currentUserId}) =&gt; {
    return (
        &lt;div className="listGroup"&gt;
          {rankings.map((ranking, index) =&gt;
              &lt;span className="number"&gt;{ranking.points}&lt;/span&gt;
          )}
        &lt;/div&gt;
    );
  };
  </code></pre>