Create a real-time chat application using TypeScript, React, custom hooks, and WebSockets. The application must allow users to send and receive messages in real time. Additionally, unit tests must be written for components and hooks using Jest and the React Testing Library.
- ChatApp: Main component that contains the application logic.
- ChatWindow: Component that displays the list of messages.
- ChatMessage: Component that represents an individual message.
- ChatInput: Component for sending new messages.
- useChat: Custom hook to handle message status and communication with the WebSocket server.
- Send a new message.
- Receive messages in real time.
- Display the message list.
- Unit tests for components and the custom hook.
This repository includes a small backend server that exposes a websocket endpoint for your testing.
cd backend/
npm run startThe server will be exposed at ws://localhost:3030