小编rei*_*x01的帖子

无法使用绑定到`partialState`的对象文字调用`this.setState`,因为string [1]不兼容字符串文字[2]

我一直在撞墙试图让这个工作,任何建议?我正在使用这里的流量反应.我正在努力理解这段代码注释的东西,我正在同时学习.起初它是压倒性的,但在我花了一些时间在谷歌搜索任何远程关闭后,我已经走到了尽头.救命?

//@flow

import React, { Component } from 'react';
import ShowCard from './ShowCard';
import Header from './Header';

type Props = {
  shows: Array<Show>
};

type State = {
  searchTerm: " "
};

class Search extends Component<Props, State> {

  handleSearchTermChange = (Event: SyntheticKeyboardEvent<KeyboardEvent> & { currentTarget: HTMLInputElement }) => {
    //this.setState({ searchTerm: event.currentTarget.value });
    const newState = this.setState({ searchTerm: Event.currentTarget.value });
    return newState;
  };

  render() {
    return (
      <div className="search">
        <Header searchTerm={this.state.searchTerm} showSearch handleSearchTermChange={this.handleSearchTermChange} />
        <div>
          {this.props.shows
            .filter(
              show =>
                `${show.title} …
Run Code Online (Sandbox Code Playgroud)

javascript setstate reactjs flowtype

6
推荐指数
1
解决办法
5051
查看次数

标签 统计

flowtype ×1

javascript ×1

reactjs ×1

setstate ×1