How to use Props with Generics with React.memo

前端 未结 4 1103
感动是毒
感动是毒 2021-01-21 15:09

I am trying to convert the following to use React.memo:

interface Props {
  // props...
}

export function Table({
          


        
4条回答
  •  温柔的废话
    2021-01-21 15:50

    I solved it by keeping it as a function, renaming the function to TableComponent and doing:

    export const Table = memo(TableComponent) as typeof TableComponent
    

提交回复
热议问题