Replies: 1 comment
-
| 
         Hello @kaiserfl, 
 The error message came with the change from Flow-typed JavaScript to TypeScript, where some internal changes had to be made to allow for correctly typed code. String option support (using the accessor props) may be possible, but needs some major internal changes to work correctly in all scenarios. In the meantime I suggest you either use object options, or a wrapper/hook which turns your simple options into objects: const SelectWithSimpleValues = ({ options, value, onChange }) => {
    const selectOptions = useMemo(() => options.map(o => ({ val: o })), [options]);
    
    const selectValue = useMemo(() => (value ? { val: value } : null), [value]);
    
    const onSelectChange = useCallback((value) => {
        onChange(value.val);
    }, [onChange]);
    return <Select
        options={selectOptions}
        value={selectValue}
        onChange={onSelectChange}
        getOptionValue={o => o.val}
        getOptionLabel={o => o.val}
    />;
} | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
In version 4.x you could use an string array as options, if you used the identity functions for getOptionValue.
In version 5.x this leads to an TypeError: "Cannot use 'in' operator to search for 'options' in X"
Question: Is this a Bug or am I using it wrong?
Beta Was this translation helpful? Give feedback.
All reactions