Skip to content

Commit 625da53

Browse files
Update changelog examples for better practices.
Avoid encouraging the redundant recall of the helper function due to reactivity of accessed props.
1 parent c94ece1 commit 625da53

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
```jsx
1111
const fetchData = async (inputValue) => { return await ... }
1212

13-
const selectProps = createAsyncOptions(fetchData);
14-
return <Select {...selectProps} />;
13+
const props = createAsyncOptions(fetchData);
14+
return <Select {...props} />;
1515
```
1616

1717
- Support displaying a loading indicator in the options lists - useful when
@@ -82,13 +82,15 @@
8282
setting disabled options based on value:
8383

8484
```jsx
85-
<Select
86-
{...createOptions(["apple", "banana", "pear", "pineapple", "kiwi"], {
85+
const props = createOptions(
86+
["apple", "banana", "pear", "pineapple", "kiwi"],
87+
{
8788
filterable: true,
8889
createable: true,
8990
disable: (value) => value === "pear",
90-
})}
91-
/>
91+
}
92+
);
93+
<Select {...props} />;
9294
```
9395

9496
Note: All of the functionality provided by the helper can be implemented
@@ -116,13 +118,15 @@
116118
updating imports and name:
117119

118120
```jsx
119-
<Select {...createFilterable(["apple", "banana", "pear"])}/>
121+
const props = createFilterable(["apple", "banana", "pear"])
122+
<Select {...props} />
120123
```
121124

122125
becomes
123126

124127
```jsx
125-
<Select {...createOptions(["apple", "banana", "pear"])}/>
128+
const props = createOptions(["apple", "banana", "pear"])
129+
<Select {...props} />
126130
```
127131

128132
As part of this change, `<mark>` tags are now used for highlighting instead of
@@ -207,7 +211,8 @@
207211
plain strings (or objects by passing a 'key' to the configuration):
208212

209213
```jsx
210-
<Select {...createFilterable(["one", "two", "three"])} />
214+
const props = createFilterable(["one", "two", "three"])
215+
<Select {...props} />
211216
```
212217

213218
- Make Select component read only by default (when a static list of options is

0 commit comments

Comments
 (0)