相关疑难解决方法(0)

类型'void'不能分配给'((event:MouseEvent <HTMLInputElement>)=> void)| 未定义"

   import * as React from "react";
   import "./App.css";
   import PageTwo from "./components/PageTwo";

    export interface IPropsk {
        data?: Array<Items>;
        fetchData?(value: string): void;
    }

    export interface IState {
       isLoaded: boolean;
       hits: Array<Items>;
       value: string;
    }
    class App extends React.Component<IPropsk, IState> {
        constructor(props: IPropsk) {
        super(props);

        this.state = {
        isLoaded: false,
        hits: [],
        value: ""
        this.handleChange = this.handleChange.bind(this);
  }   

  fetchData = val => {
        alert(val);
  };

  handleChange(event) {
       this.setState({ value: event.target.value });
  }


  render() {
   return (
      <div>
        <div>
           <input type="text" value={this.state.value} onChange= …
Run Code Online (Sandbox Code Playgroud)

javascript typescript reactjs

26
推荐指数
3
解决办法
2万
查看次数

标签 统计

javascript ×1

reactjs ×1

typescript ×1