import React from 'react';
import { connect } from 'react-redux';
let nextItemId = 0;

let AddItem = ({ dispatch }) => {
  let activity, target, unit;

  return (
    <form
      onSubmit={e => {
        e.preventDefault();
        if (!activity.value.trim()) {
          return;
        }
        dispatch({
          type: 'ADD_ITEM',
          id: nextItemId++,
          activity: activity.value,
          target: target.value,
          unit: unit.value
        });
        activity.value = "";
        target.value = "";
        unit.value = "";
      }}
    >
      <input
        type="text"
        placeholder="Activity"
        ref={node => {activity = node}}
      />
      <input
        type="number"
        placeholder="Target"
        ref={node => {target = node}}
      />
      <input
        type="text"
        placeholder="Unit"
        ref={node => {unit = node}}
      />
      <button type="submit">
        Add Item
      </button>
    </form>
  )
}

AddItem = connect(
  state => {
    return {};
  },
  dispatch => {
    return { dispatch };
  }
)(AddItem);

export default AddItem;
@@ -993,87 +993,8 @@
 ect(
-%0A  state =%3E %7B%0A    return %7B%7D;%0A  %7D,%0A  dispatch =%3E %7B%0A    return %7B dispatch %7D;%0A  %7D%0A
 )(Ad

Simplify connect() function call in AddItem component