summaryrefslogtreecommitdiff
path: root/web/src/pages/echo.js
blob: 6ba7e67df3323b983d9a7a3e3bbff62d724c8176 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React from "react";
import { useLoaderData, useParams } from "react-router";
import Message from "../components/message";

const Echo = () => {
    const {echo, messages} = useLoaderData();
    const params = useParams();
    if (!echo)  {
        return (<article aria-busy="true">Загрузка списка сообщений</article>)
    }
    return (
        <>
            <h1>{echo.name}</h1>
            <p>Сообщений: {echo.count}</p>
            {messages.map((message) => (
                <Message key={message.id} message={message} />
            ))}
        </>
    );
};

export default Echo;