Type 'void' is not assignable to type '((event: MouseEvent) => void) | undefined'

后端 未结 5 1721
花落未央
花落未央 2020-12-24 11:06
   import * as React from \"react\";
   import \"./App.css\";
   import PageTwo from \"./components/PageTwo\";

    export interface IPropsk {
        data?: Array&l         


        
5条回答
  •  旧时难觅i
    2020-12-24 11:19

    You could also do something like

    fetchData = (val: string) => (event: any) => {
      alert(val);
    };
    

    Alternatively, you can set a type for your event, such as React.MouseEvent. You can read more about it here.

提交回复
热议问题