Skip to content

Commit 1a38c71

Browse files
committed
Clear value after selection
1 parent 10de583 commit 1a38c71

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class App extends Component {
5050
this.state = {
5151
options: options,
5252
lists: lists,
53+
value: ""
5354
}
5455
this.handleCountry = this.handleCountry.bind(this)
5556
this.loadOptions = this.loadOptions.bind(this)
@@ -61,7 +62,8 @@ class App extends Component {
6162
this.state.lists = makeUnique(this.state.lists)
6263

6364
this.setState({
64-
lists: [...new Set(this.state.lists)]
65+
lists: [...new Set(this.state.lists)],
66+
value: ""
6567
}, () => {
6668
setLocal('items', this.state.lists)
6769
})
@@ -103,7 +105,7 @@ class App extends Component {
103105
<div className="row">
104106
<div className="col-md-8 offset-md-2">
105107
<h3 className="text-center" id="title">TimeZone Track </h3>
106-
<AsyncSelect id="country" className="text-center" cacheOptions loadOptions={this.loadOptions} placeholder={"Search for your City"} onChange={this.handleCountry} noOptionsMessage={() => "Search for your City"} />
108+
<AsyncSelect id="country" className="text-center" cacheOptions loadOptions={this.loadOptions} placeholder={"Search for your City"} onChange={this.handleCountry} noOptionsMessage={() => "Search for your City"} value={this.state.value}/>
107109
<List lists={this.state.lists} deleteCountry={this.deleteCountry}/>
108110
</div>
109111
</div>

0 commit comments

Comments
 (0)