In React, How to Format a Number with Commas?

My API is sending React integers like 10, 31312, 4000.

In my React component, what's the right way to format these numbers like so:

from: 10, 31312, 4000
to: 10, 31,312, 4,000

Update

The number is being provided by my Rails API and rendered in a React component:

const RankingsList = ({rankings, currentUserId}) => {
  return (
      <div className="listGroup">
        {rankings.map((ranking, index) =>
            <span className="number">{ranking.points}</span>
        )}
      </div>
  );
};
3
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.