I am trying to print the value from API data and currently, I am able to print it. Now, I would like to print in the order of highest values to lowest values. I would like to show the array data by the highest value to the lowest. But, I am having a tough time figuring out how to do this. Here is my code:
const userPoints = [
{
name: "John",
value: "50"
},
{
name: "James",
value: "70"
},
{
name: "Sam",
value: "30"
},
{
name: "Jane",
value: "35"
},
]
return (
<>
{userPoints.map((item, i)=>(
<div key={i}>
<h1>{item.name}</h1>
<h1>{item.value}</h1>
</div>
))
}
</>
)
This is the order I want to print
