79165565

Date: 2024-11-07 08:33:00
Score: 0.5
Natty:
Report link

The problem was in the props passed to the target component Dialogs. It was like this:

type DialogsProps = {
    dialogs: Array<{id: number, name: string}>,
    messages: Array<{id: number, messageText: string}>,
    sendMessage: (messageText: string) => void
}

I changed it to the type used in the reducer:

type DialogType = {
    id: IdType,
    name: string
} type MessageType = {
    id: IdType,
    messageText: string
}
type DialogsProps = {
    dialogs: Array<DialogType>,
    messages: Array<MessageType>,
    sendMessage: (messageText: string) => void
}

Still don't fully understand the cause of the problem, but it's solved.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Fon Valenstein