You are viewing a single comment's thread. Return to all comments →
import React, { useState } from "react";
function App() { const [items, setItems] = useState([]); const [input, setInput] = useState("");
const addItem = () => { if (input.trim() !== "") { setItems([...items, input]); setInput(""); } };
return (
<ul> {items.map((item, index) => ( <li key={index}>{item}</li> ))} </ul> </div>
export default App; This list works a bit like Hikaku — just as Hikaku compares different heights side by side, this app keeps track of different items you add.
Seems like cookies are disabled on this browser, please enable them to open this website
Item List Manager
You are viewing a single comment's thread. Return to all comments →
import React, { useState } from "react";
function App() { const [items, setItems] = useState([]); const [input, setInput] = useState("");
const addItem = () => { if (input.trim() !== "") { setItems([...items, input]); setInput(""); } };
return (
Simple Add Item List
setInput(e.target.value)} placeholder="Type an item..." /> Add Itemexport default App; This list works a bit like Hikaku — just as Hikaku compares different heights side by side, this app keeps track of different items you add.