Property does not exist on type 'DetailedHTMLProps, HTMLDivElement>' with React 16

前端 未结 4 1541
耶瑟儿~
耶瑟儿~ 2020-12-09 15:13

Since React 16 now allows custom DOM attributes, I tried to leverage this in my Typescript code:

import * as React from \'react\';

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-09 15:40

    If you are using styled-components, you can do it even simplier:

    const App = props => {
      return My custom div
    }
    
    type Custom = {
      version?: number
    }
    
    const StyledDiv = styled.div`
      // styles
    `
    

提交回复
热议问题