From 563e5d7e989146ad58ecf3c62debd4fe1e55c71f Mon Sep 17 00:00:00 2001 From: Robin van der Vleuten Date: Thu, 15 Jun 2017 13:18:10 +0200 Subject: [PATCH] Using object spread to bind actions --- README.md | 2 +- src/components/app.js | 3 +-- src/util.js | 7 ------- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 src/util.js diff --git a/README.md b/README.md index 08aa4bb..ad49119 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Preact Redux Example -A **10kb** Redux-powered alternative to [preact-boilerplate](https://github.com/developit/preact-boilerplate), implementing a To-Do List app. +A **9kb** Redux-powered alternative to [preact-boilerplate](https://github.com/developit/preact-boilerplate), implementing a To-Do List app. diff --git a/src/components/app.js b/src/components/app.js index b17039a..c26fbb7 100644 --- a/src/components/app.js +++ b/src/components/app.js @@ -1,11 +1,10 @@ import { h, Component } from 'preact'; import { connect } from 'preact-redux'; -import { bindActions } from '../util'; import reduce from '../reducers'; import * as actions from '../actions'; import TodoItem from './todo-item'; -@connect(reduce, bindActions(actions)) +@connect(reduce, { ...actions }) export default class App extends Component { addTodos = () => { const { text } = this.state; diff --git a/src/util.js b/src/util.js deleted file mode 100644 index 1ebc4d8..0000000 --- a/src/util.js +++ /dev/null @@ -1,7 +0,0 @@ -import { bindActionCreators } from 'redux'; - -export function bindActions(actions) { - return dispatch => ({ - ...bindActionCreators(actions, dispatch) - }); -}