In react-ts, anonymous functions are not allowed in render. If anonymous functions are not used, state updates are not allowed.

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
Apr.20,2022

the error report is tslint. I just want to turn off the anonymous function restriction


directly

<div onClick={this.onChange}></div> 

is fine

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cb83-2c33d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cb83-2c33d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?