Created
August 17, 2017 11:18
-
-
Save yarnball/b1ceb864b397a7834940e2ddb318b317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Paper from 'material-ui/Paper'; | |
class SearchBar extends React.Component { | |
state = { | |
test:false, | |
}; | |
componentWillMount(){ | |
this.setState({ test: !this.state.test }, () => { this.focus(); }); | |
} | |
focus = () => { | |
console.log('this ran!') | |
this.refs.searcher.focus(); | |
} | |
render() { | |
const { onSearchChange, search } = this.props; | |
return ( | |
<Paper className='searchInput' > | |
<input onChange={onSearchChange} ref="searcher" placeholder="Search" type="text" /> | |
</Paper> | |
); | |
} | |
} | |
export default SearchBar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment