How do I change a list item in an unordered list upon a button in that list item being pressed?
Say I have React code that looks like this (as an example): export default function Page() { const [items, setItems] = useState<CustomObject[] / null>(null); return ( <ul className="unordered-list"> {items?.map((l) => ( <li className="list-item"> {/* More HTML */} <button className="change-li" onClick={() => change(l)}></button> </li> ))} </ul> ); When the change-li button is pressed, l is rendered differently. (as in, a complete rework of everything in it, with different styling and content) I've tried passing it to a function such as change, but that would only really help with changing some
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.