Adding sort icon in react

Solution 1:

I saw your path was rendered twice, Im afraid if the first render is undefined, thus it return error.

To solve this error you may add this to your function:

renderSortIcon = column => {
  
  const {sortColumn} = this.props

if (column?.path !== sortColumn?.path) return null;
if (sortColumn?.order === "asc") return <i className="fa fa-sort-asc" />;
return <i className="fa fa-sort-desc" />;
};