score:3

Accepted answer

are you just calling this.onprojectselect.bind(this); or are you assigning it back go this.onprojectselect? the bind function returns a new function, so i would expect to see:

this.onprojectselect = this.onprojectselect.bind(this);

score:2

i think you could be missing the state initializing on the constructor, or maybe you are just making a mistake in the binding. i would do something like this:

export default class test extends component{

  constructor(props) {
    super(props)

    this.state = {
      project: ''
    }
  }

  onprojectselect = (e) => {
    this.setstate({
      project: e.target.value
    });
  }

  render(){
    return (
      <select2
        data={basicstore.projectsselect2format}
        onchange={this.onprojectselect}
        options={{
          placeholder: 'search project',
        }}
      />
    )
  }
}

Related Query

More Query from same tag