How do you create optgroups in react-select v2?
options is the magic key:
render() { const options = [ { label: "Group 1", options: [ { label: "Group 1, option 1", value: "value_1" }, { label: "Group 1, option 2", value: "value_2" } ] }, { label: "A root option", value: "value_3" }, { label: "Another root option", value: "value_4" } ]; return <Select options={options} />}
This renders the way that I expect.