React Typescript - Adding custom attribute

后端 未结 2 669
失恋的感觉
失恋的感觉 2021-02-13 06:09

React Typescript allow to add custom data-* attributes. But is it possible to add custom attributes like \'name\' || \'test\' act. ?



        
2条回答
  •  攒了一身酷
    2021-02-13 06:31

    in react 16+ it is possible, see

    probem is that typescript didnt know about it(yet)

    but you can still add @ts ignore for typechecking

    { //@ts-ignore
      
    }
    

提交回复
热议问题