小编use*_*402的帖子

Async React-select with redux

我正在尝试使用redux创建一个异步react-select组件,但不知何故无法在下拉列表中获取搜索结果.对此非常陌生.请帮忙 :)

import React, { PropTypes } from 'react';
import { Link } from 'react-router';
import { connect } from 'react-redux';
import Select from 'react-select';

import { fetchInstitutionsIfNeeded } from '../../actions/institutions';

class Signup extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            value: null
        };
        this.getInstitutions = this.getInstitutions.bind(this);
        this.onChange = this.onChange.bind(this);
    }

    onChange(input) {
        this.setState({
            value: input
        });
    }

    getInstitutions(input) {
        const { dispatch } = this.props;
        if (!input) {
            return Promise.resolve({ options: [] });
        }
        dispatch(fetchInstitutionsIfNeeded(input));
    }

    render() { …
Run Code Online (Sandbox Code Playgroud)

react-select redux

11
推荐指数
1
解决办法
3136
查看次数

标签 统计

react-select ×1

redux ×1