import { useEffect } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { useSignal } from '@vaadin/hilla-react-signals';
import { MessageInput } from '@vaadin/react-components/MessageInput';
import { MessageList } from '@vaadin/react-components/MessageList';
import { VerticalLayout } from '@vaadin/react-components/VerticalLayout';
import Channel from 'Frontend/generated/com/example/application/chat/Channel';
import { ChatService } from 'Frontend/generated/endpoints';
export default function ChannelView() {
const { channelId } = useParams();
const channel = useSignal<Channel | undefined>(undefined);
const navigate = useNavigate();
return (
<VerticalLayout theme="padding spacing" className="h-full">
<MessageList className="h-full w-full border" />
<MessageInput className="w-full" />
</VerticalLayout>
);
}
This is my code now. App acts in the same way now and when I add the code from " Fetch Channel Information" chapter: when I click the link /channel/1000 I can see chat view, but when I go to some url with generated ID I got this screenshot which I attached before.
That’s the reason then. You have mapped the channel view to the exact string 1000. You want the file name to be views/channel/{channelId}.tsx to capture the channel id into the parameter you read with useParams()