Display a data in render depending on the value get?


I’m actually using the riot games API, and using the data to make a similar op.gg ( Only for me and like doing something that I like ! react and League :D), I also need to add that I’m a newbie in react and programming in general.

So what I’m trying to do now is to display a text “rich” at the person which got the highest amount of gold in the game.

So I stored the golds in an array like this :

.then(res => {
                for (let i = 0; i < 10; i++) {
                    this.setState({ name:
                            [...this.state.name, res.data.participantIdentities[i].player.summonerName] });
                    this.setState({ golds:
                            [...this.state.golds, res.data.participants[i].stats.goldEarned] });

I sorted my array and get the one which correspond to my value. :

GetMaxValue() {
        let SortGold = this.state.golds.sort();
        let BestGold = SortGold[9];
        for (let i = 0; i < this.state.golds.length; i++) {
            if (BestGold === this.state.golds[i]) {
                let HighestGold = this.state.gold[i];

So I know which value is the highest.

But here come the problem, I have no idea how I can associate HighestGold to my current player.

I think about, in my constructor, add this IsTheRichest: false, and in my render add if value of HighestGold == this.state.gold[i], Set IsTheRichest: false, to true and display a text.

I’m in a good way? Or i’m going to a route of despair xD ?

Thanks for your future help !