React-select: [1.0.0-beta12] Can't select anything

Created on 5 Apr 2016  路  3Comments  路  Source: JedWatson/react-select

I'm testing this library, but i can't make it work properly, when i try to click on an element in the popup, it doesn't select the element, i'm using it as following:

import React from 'react';
import Modeler from '../containers/modeler/modeler';
import ModelerForm from '../containers/modeler/modeler-form';
import Select from 'react-select';
var options = [
  {value: '7fjJFCc2ehdm4SBBPIqPwT', label: 'Admins'},
  {value: '4RAk1ZzzZsnbk5VlDQeSVy', label: 'Nurses'}
];
export default function ProcessNew({params}){
  return (
    <div>
      <Select
        name="select-group"
        onChange={(n, s) => console.log(n,s)}
        options={options}
        />
      <Modeler processId={params.processId} />
      <ModelerForm />
    </div>
  );
}

Most helpful comment

@varun-raj this is a controlled component, so i have to create an state and pass it as value and a onChange properties to the component itself.

          <Select
            labelKey="name"
            name="field-name"
            onChange={(newValue) => selectElementParticipants(newValue)}
            options={participants}
            isLoading={isFetching}
            disabled={isFetching}
            searchable={false}
            valueKey="id"
            value={this.state.participants}

All 3 comments

My bad, this is a Controlled component.

Even I'm facing the same issue :/ what to do ?

@varun-raj this is a controlled component, so i have to create an state and pass it as value and a onChange properties to the component itself.

          <Select
            labelKey="name"
            name="field-name"
            onChange={(newValue) => selectElementParticipants(newValue)}
            options={participants}
            isLoading={isFetching}
            disabled={isFetching}
            searchable={false}
            valueKey="id"
            value={this.state.participants}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbonaci picture mbonaci  路  3Comments

mjuopperi picture mjuopperi  路  3Comments

coder-guy22296 picture coder-guy22296  路  3Comments

x-yuri picture x-yuri  路  3Comments

ericj17 picture ericj17  路  3Comments