Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes

后端 未结 7 2993
梦如初夏
梦如初夏 2020-12-15 02:42

i am currently making a simple react application. this is my index.tsx

import * as React from \'react\';
import * as ReactDOM from \'react-dom\         


        
7条回答
  •  长情又很酷
    2020-12-15 02:53

    I also faced the same problem. Add below code to work with .tsx components.

    export interface Props {
      term: string;
    }
    

    or

    export type Props = {
      term ?: string;
    }
    

    I dont know the exact reason, but i think typescript flag the type error during compilation phase. Let me know if it works for you.

提交回复
热议问题