in Output/Llama31_405B/JS/contextual_experiment/translate_to_react/1722507915/components/TodoForm.tsx [5:19]
function TodoForm() {
const [title, setTitle] = useState('');
const dispatch = useDispatch();
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (title.trim()) {
dispatch(addTodo(title));
setTitle('');
}
};
return (
<form onSubmit={handleSubmit}>
<input type='text' value={title} onChange={(e) => setTitle(e.target.value)} />