DEV Community

Raushan Kumar
Raushan Kumar

Posted on

Todo Application in Reactjs

INTRO

import React, { useState } from 'react';
import './App.css';

function App() {
const [text, setText] = useState(""),
[todos, setTodos] = useState([])

const add = () => {
return setTodos([...todos, text])
}

const deleteTodo = (i) => {
const updatedTodos = todos.filter((todo, index) => index !== i)
console.log("TCL: deleteTodo -> updatedTodos", updatedTodos)
return setTodos(updatedTodos)
}

return (


10Min Todo App


setText(e.target.value)} />

    {todos.map((todo, i) => { return (<>
  • {todo}
  • </>) })}


);
}

export default App;

Top comments (0)