aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-12-13 12:19:37 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-12-13 12:19:37 +0100
commit41a01f056984dc74f47e0380e2fe28fa16a59ff7 (patch)
tree9dd64a1686e568f7659c498576e3491d8dcc498c
parent58f69c010e55ded87dd5976a61a543183e26cba9 (diff)
Use inline dispatch
-rw-r--r--src/client/react/components/container/Search.jsx16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/client/react/components/container/Search.jsx b/src/client/react/components/container/Search.jsx
index a26c277..e974bd9 100644
--- a/src/client/react/components/container/Search.jsx
+++ b/src/client/react/components/container/Search.jsx
@@ -5,7 +5,7 @@ import classnames from 'classnames';
import SearchIcon from 'react-icons/lib/md/search';
-import { inputChange, focusChange } from '../../actions/search';
+import { inputChange } from '../../actions/search';
import Results from './Results';
import IconFromUserType from '../presentational/IconFromUserType';
@@ -41,9 +41,9 @@ class Search extends React.Component {
render() {
const {
- onInputChange,
value,
exactMatch,
+ dispatch,
} = this.props;
const {
@@ -61,7 +61,7 @@ class Search extends React.Component {
</div>
<input
id="search__input"
- onChange={onInputChange}
+ onChange={event => dispatch(inputChange(event.target.value))}
value={value}
placeholder="Zoeken"
onFocus={this.onFocus}
@@ -75,9 +75,9 @@ class Search extends React.Component {
}
Search.propTypes = {
- onInputChange: PropTypes.func.isRequired,
value: PropTypes.string.isRequired,
exactMatch: PropTypes.shape(userShape),
+ dispatch: PropTypes.func.isRequired,
};
Search.defaultProps = {
@@ -90,10 +90,4 @@ const mapStateToProps = state => ({
exactMatch: state.search.exactMatch,
});
-const mapDispatchToProps = dispatch => ({
- onInputChange: (event) => {
- dispatch(inputChange(event.target.value));
- },
-});
-
-export default connect(mapStateToProps, mapDispatchToProps)(Search);
+export default connect(mapStateToProps)(Search);