const arr = [
{name: 'aaa', age: 12},
{name: 'bbb', age: 15},
{name: 'ccc', age: 20},
{name: 'ddd', age: 55},
{name: 'fff', age: 2},
];
const min = arr.reduce((acc, el) => {
return acc.age < el.age ? acc : el
});
console.log(min.age) // 2
const arr = [
{name: 'aaa', age: 12},
{name: 'bbb', age: 15},
{name: 'ccc', age: 20},
{name: 'ddd', age: 55},
{name: 'ааа', age: 2},
];
const minNum = Math.min.apply(null, arr.map(el => el.age));
console.log(minNum) // 2
if (!object) {
return <Spinner />
}
return (
вся нужная разметка
)
https://i.gyazo.com/1a10f045b11ec384554cce5b25601b...