const renderItem = (item: string, index: number) => {
console.log(warpProps.handleItemDelete)
return (
<List.Item>
<p onClick={warpProps.handleItemDelete(index)}>{item}
</List.Item>
)
}
report an error
Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.
if it is an anonymous function
const renderItem = (item: string, index: number) => {
console.log(warpProps.handleItemDelete)
return (
<List.Item>
<p onClick={() => warpProps.handleItemDelete(index)}>{item}
</List.Item>
)
}
report an error
Lambdas are forbidden in JSX attributes due to their rendering performance impact