H
H
Heorhii2019-02-04 21:00:56
JavaScript
Heorhii, 2019-02-04 21:00:56

How to light up icons at 3 highest values?

Good evening everyone. The thing is - I can’t figure out how to select the 3 largest values ​​​​from the array, for example, count_pub and add a picture to them in item, I tried everything I knew (I knew a little, but nevertheless), and every time my application successfully crashes, I suffer on React .

import React, { Component } from 'react';
import Authors from './data.json';
import Avatar from 'react-avatar';

class AuthorList extends Component {
  render() {
//*      Authors.length = 10;
    return (
      <div>
          {Authors.map((AuthorDetail, index)=>{
                return <div className="item" key = {index}>
                    <div className="author-info">
                        <Avatar name={AuthorDetail.name} size="50" maxInitials="1" round />
                        <div>
                            <p className="author">{AuthorDetail.name}</p>
                            <p className="count">{AuthorDetail.count_pub} публ.</p>
                        </div>
                    </div>
                    <img src={} height="50" alt="" />
                    <p className="views">{AuthorDetail.pageviews}</p>
                </div>
            })}
      </div>
    );
  }
}

export default AuthorList;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Kirenkov, 2019-02-04
@DeLaVega

1. Your question and description are out of sync
2. What does it mean to crash? What mistake?
3. Pictures - there must be an appropriate loader in the webpack (if you use it)
4. Where exactly should I look in the code? What's wrong?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question