'React select onChange value Type

 <Select
        
        options={options}
        value={selectedBusinessList}
        isMulti
        placeholder="Select Business"
        onChange={(value: any) => setSelectedBusinessList(value)}
        onInputChange={query => {
          if (query) {
            setOptions([]);
            fetchBusiness(query, { limit: 10, offset: 0 });
          }
        }}
      />

What should be type of onChange event value.

Here each value is of

type OptionType = { label : string; value:string}

setSelectedBusinessList() is taking argument of type OptionType



Solution 1:[1]

Try this :

onChange={(e: any) => setSelectedBusinessList(e.target.value)}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kai - Kazuya Ito