Skip to content

Instantly share code, notes, and snippets.

@jacobp100
Last active January 16, 2018 20:27
Show Gist options
  • Save jacobp100/cf2407f06b8239ce40562333b87ddc09 to your computer and use it in GitHub Desktop.
Save jacobp100/cf2407f06b8239ce40562333b87ddc09 to your computer and use it in GitHub Desktop.
const App = connect(state => state, dispatch => ({
setSearch: e => {
dispatch({ type: 'SET_SEARCH', search: e.target.value })
}
}))(({ search, results, setSearch }) => (
<div>
<input value={search} onChange={setSearch} />
{results.map(result => (
<div key={result}>{result}</div>
))}
</div>
))
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment