|
10 | 10 | ```jsx |
11 | 11 | const fetchData = async (inputValue) => { return await ... } |
12 | 12 |
|
13 | | - const selectProps = createAsyncOptions(fetchData); |
14 | | - return <Select {...selectProps} />; |
| 13 | + const props = createAsyncOptions(fetchData); |
| 14 | + return <Select {...props} />; |
15 | 15 | ``` |
16 | 16 |
|
17 | 17 | - Support displaying a loading indicator in the options lists - useful when |
|
82 | 82 | setting disabled options based on value: |
83 | 83 |
|
84 | 84 | ```jsx |
85 | | - <Select |
86 | | - {...createOptions(["apple", "banana", "pear", "pineapple", "kiwi"], { |
| 85 | + const props = createOptions( |
| 86 | + ["apple", "banana", "pear", "pineapple", "kiwi"], |
| 87 | + { |
87 | 88 | filterable: true, |
88 | 89 | createable: true, |
89 | 90 | disable: (value) => value === "pear", |
90 | | - })} |
91 | | - /> |
| 91 | + } |
| 92 | + ); |
| 93 | + <Select {...props} />; |
92 | 94 | ``` |
93 | 95 |
|
94 | 96 | Note: All of the functionality provided by the helper can be implemented |
|
116 | 118 | updating imports and name: |
117 | 119 |
|
118 | 120 | ```jsx |
119 | | - <Select {...createFilterable(["apple", "banana", "pear"])}/> |
| 121 | + const props = createFilterable(["apple", "banana", "pear"]) |
| 122 | + <Select {...props} /> |
120 | 123 | ``` |
121 | 124 |
|
122 | 125 | becomes |
123 | 126 |
|
124 | 127 | ```jsx |
125 | | - <Select {...createOptions(["apple", "banana", "pear"])}/> |
| 128 | + const props = createOptions(["apple", "banana", "pear"]) |
| 129 | + <Select {...props} /> |
126 | 130 | ``` |
127 | 131 |
|
128 | 132 | As part of this change, `<mark>` tags are now used for highlighting instead of |
|
207 | 211 | plain strings (or objects by passing a 'key' to the configuration): |
208 | 212 |
|
209 | 213 | ```jsx |
210 | | - <Select {...createFilterable(["one", "two", "three"])} /> |
| 214 | + const props = createFilterable(["one", "two", "three"]) |
| 215 | + <Select {...props} /> |
211 | 216 | ``` |
212 | 217 |
|
213 | 218 | - Make Select component read only by default (when a static list of options is |
|
0 commit comments