I'm having an issue with the ContainerComponent and ContainerProps, i think the problem is that "li" is of type string, and i need to explicity define it as type of React.ElementType<React.HTMLAttributes>, but i don't know how.
<ListItem
ContainerComponent="li"
ContainerProps={{ ref: provided.innerRef }}
{...provided.draggableProps}
{...provided.dragHandleProps}
style={getItemStyle(
snapshot.isDragging,
provided.draggableProps.style
)}
>
The Error I'm getting:
No overload matches this call. The last overload gave the following error. Type '"li"' is not assignable to type 'ElementType<HTMLAttributes> | undefined'. Type '{ ref: (element?: HTMLElement | null | undefined) => any; }' is not assignable to type 'HTMLAttributes'. Object literal may only specify known properties, and 'ref' does not exist in type 'HTMLAttributes'.ts(2769)
Solved this by writing:
<ListItem
ContainerComponent={(<li />).type}
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
style={getItemStyle
snapshot.isDragging,
provided.draggableProps.style)}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With