const renderItem = (item: string, index: number) => { console.log(warpProps.handleItemDelete) return ( <List.Item>
<p onClick={warpProps.handleItemDelete(index)}>{item}</p>
</List.Item>
)
}报错
Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.
如果是匿名函数
const renderItem = (item: string, index: number) => { console.log(warpProps.handleItemDelete) return ( <List.Item>
<p onClick={() => warpProps.handleItemDelete(index)}>{item}</p>
</List.Item>
)
}报错
Lambdas are forbidden in JSX attributes due to their rendering performance impact
繁花如伊
慕婉清6462132
随时随地看视频慕课网APP
相关分类