How to use Props with Generics with React.memo

前端 未结 4 1157
感动是毒
感动是毒 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 16:09

    Simple, just pass a non-arrow function to React.memo:

    export const Table = React.memo(function(props: Props) {
    
    })
    

    or if you need default export:

    export default React.memo(function Table(props: Props) {
    
    })
    

提交回复
热议问题