()
| 4 | import './App.css' |
| 5 | |
| 6 | function App() { |
| 7 | const [count, setCount] = useState(0) |
| 8 | const [showbtn, setshowbtn] = useState(false) |
| 9 | const [todos, setTodos] = useState([ |
| 10 | { |
| 11 | title: "Hey", |
| 12 | desc: "I am a good todo" |
| 13 | }, |
| 14 | { |
| 15 | title: "Hey Another todo", |
| 16 | desc: "I am a good todo too" |
| 17 | }, |
| 18 | { |
| 19 | title: "Hey I am grocery todo", |
| 20 | desc: "I am a good todo but I am grocery todo" |
| 21 | }, |
| 22 | |
| 23 | ]) |
| 24 | |
| 25 | // const Todo = ({todo}) => { |
| 26 | // return (<> |
| 27 | // <div className="m-4 border border-1 border-purple-400"> |
| 28 | |
| 29 | // <div className="todo">{todo.title}</div> |
| 30 | // <div className="todo">{todo.desc}</div> |
| 31 | // </div> |
| 32 | // </>) |
| 33 | // } |
| 34 | |
| 35 | return ( |
| 36 | <> |
| 37 | <div> |
| 38 | <a href="https://vitejs.dev" target="_blank"> |
| 39 | <img src={viteLogo} className="logo" alt="Vite logo" /> |
| 40 | </a> |
| 41 | <a href="https://react.dev" target="_blank"> |
| 42 | <img src={reactLogo} className="logo react" alt="React logo" /> |
| 43 | </a> |
| 44 | </div> |
| 45 | <h1>Vite + React</h1> |
| 46 | {showbtn ? <button>showbtn is true</button> : <button>showbtn is false</button>} |
| 47 | {/* {showbtn && <button>showbtn is true</button>} */} |
| 48 | |
| 49 | {todos.map(todo => { |
| 50 | // return <Todo key={todo.title} todo={todo}/> |
| 51 | return <div key={todo.title} className="m-4 border border-1 border-purple-400"> |
| 52 | |
| 53 | <div className="todo">{todo.title}</div> |
| 54 | <div className="todo">{todo.desc}</div> |
| 55 | </div> |
| 56 | })} |
| 57 | <div className="card"> |
| 58 | <button onClick={() => setshowbtn(!showbtn)}> |
| 59 | Toggle showbtn |
| 60 | </button> |
| 61 | <p> |
| 62 | Edit <code>src/App.jsx</code> and save to test HMR |
| 63 | </p> |
nothing calls this directly
no outgoing calls
no test coverage detected