// src/App.js import React, { useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; // state.todos); // <-- Read state from store const dispatch = useDispatch(); // { if (todoText) { dispatch(addTodo(todoText)); // <-- Dispatch addTodo action setTodoText(''); } }; return ( <div> <h1>Todo List</h1> setTodoText(e.target.value)} placeholder="Add a new todo" /> <button>Add Todo</button> <ul> {todos.map((todo, index) => ( <li> dispatch(toggleTodo(index))} // {todo.text} </li> ))} </ul> </div> ); } export default App;