score:1

interface Todo {
  text: string;
  completed: boolean;
}

type State = Array<Todo>;

const TodoReducer = (state: State = [], action: Actions) => { // added a default state
  switch (action.type) {
    case "add":
      console.log("add");
      return state; // return your desired state
    case "remove":
      console.log("remove");
      return state; // return your desired state
    default:
      return state; // you did miss return state or similar here in your example
  }
};

const Input: React.FC<Props> = ({ name, onChange }) => {
  ...
  const [todos, dispatch] = React.useReducer(TodoReducer, []);
  ...
};

Related Query

More Query from same tag