Is it possible to add OptGroup to options prop in Select component from Ant Design (https://ant.design/components/select/)?
import React from 'react';
import { Select } from 'antd';
const Places = () => {
function handleChange(value, objectValues) {
console.log(value);
console.log(objectValues);
}
return (
<>
<Select
labelInValue
defaultValue={{ value: 'Lucy' }}
style={{ width: 120 }}
onChange={handleChange}
options={[ // add OptGroup here ??
{ label: 'Jack', value: 'Jack', id: '1' },
{ label: 'Lucy', value: 'Lucy', id: '2' },
]}
/>
</>
);
};
export default Places;
instead of doing it like this the traditional way, I want to add the OptGroup to the options prop.
<Select defaultValue="lucy" style={{ width: 200 }} onChange={handleChange}>
<OptGroup label="Manager">
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
</OptGroup>
</Select>