小编Cat*_*020的帖子

使用反应选择我遇到了下一个问题:无法读取未定义的属性“值”

我在用着react-select。当我从 select 中选择一个确定值时,我遇到了下一个问题

类型错误:无法读取未定义的属性“值”

另外,从减速器获取的值todoList没有显示,我看不到它们。

这是我的代码:

import Select from "react-select";
import "./styles.css";
import { searchTodos } from "../../actions/ServiceActions";

class SelectedTodo extends Component {
  constructor(props) {
    super(props);
    this.state = {
      selectedTodo: ""
    };
    this.handleChange = this.handleChange.bind(this);
  }
  bringTodos = () => {
    //WHEN I'M EXECUTING THESE CODE LINES I CAN'T SEE TODOS VALUES
    return this.props.todoList.map(todo => {
      return (
        <option key={todo._id} value={todo._id}>
          {todo.name}
        </option>
      );
    });
  };

  handleChange = e => {
    this.setState({ selectedTodo: e.target.value });
  }; …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-select redux redux-form

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

javascript ×1

react-select ×1

reactjs ×1

redux ×1

redux-form ×1