import React, {useState, useEffect} from 'react'; export const LoadingTeamsForm = (): JSX.Element => { const [user, setUser] = useState([]); useEffect(() => { fetch('/api/loadingLegisteredCommands', { method: 'POST'}) .then(res => res.json()) .then(json => setUser(json)) },[1]); const flatten = (arr) => { const result = []; console.log(Math.min(arr)); arr.forEach((i) => { if (Array.isArray(i)) { result.push(...flatten(i)); } else { result.push(i); } }); return result; } //console.log(user[3].class) return (
Название команды | ФИО тренера | Учебное заведение | ФИО участников | Возрастная группа |
---|---|---|---|---|
{rows.team_name} | {rows.name_team_coach} | {rows.training_institution_team} | {rows.name_first_participant +', ' + rows.name_second_participant + ', ' + rows.name_third_party} | { flatten(rows.class) } |