Skip to content

Commit 3dd18b8

Browse files
authored
Merge pull request #58 from variadicjs/refactor-dropdown
pass just needed data to Dropdown
2 parents c73436a + 2a023b5 commit 3dd18b8

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/components/Dropdown.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,12 @@ const Dropdown = (props) => {
1111
}
1212

1313
const {data} = props;
14-
15-
//Avoiding mutation
16-
let cardData = Object.assign({}, data);
17-
Object.keys(cardData).forEach(key => {
18-
return cardData[key] = null
19-
});
20-
14+
2115
return(
2216
<Autocomplete
2317
style={s}
2418
title='Function'
25-
data={cardData}
19+
data={data}
2620
onChange={props.handleDropdownChange}
2721
/>
2822
)

src/containers/CardList.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ class CardList extends Component {
4747
</div>
4848
));
4949

50+
const data = {};
51+
funcNames.forEach(funcName => data[funcName] = null);
52+
5053
return (
5154
<div style={flexContainer}>
5255
<Dropdown
53-
data={variadic}
56+
data={data}
5457
handleDropdownChange={(e, value) => this.handleDropdownChange(value)}
5558
/>
5659
<Carousel>

0 commit comments

Comments
 (0)