|
|
@@ -6,36 +6,9 @@ import { MouseEvent } from "react";
|
|
|
// Following tutorial https://www.youtube.com/watch?v=SqcY0GlETPk
|
|
|
|
|
|
function App() {
|
|
|
- const items = ["Dude", "Man", "Shit"];
|
|
|
+ const items = ["Dude", "Man", "Shit", "Is it working?"];
|
|
|
|
|
|
- const [activeListItem, setActiveListItem] = useState(-1);
|
|
|
-
|
|
|
- const myClickHandlerMan = (event: MouseEvent) => {
|
|
|
- console.log(event);
|
|
|
-
|
|
|
- setActiveListItem(2);
|
|
|
- };
|
|
|
-
|
|
|
- return (
|
|
|
- <>
|
|
|
- <h1>The list</h1>
|
|
|
- <ul className="list-group">
|
|
|
- {items.map((item, index) => (
|
|
|
- <li
|
|
|
- className={
|
|
|
- activeListItem === index
|
|
|
- ? "list-group-item active"
|
|
|
- : "list-group-item"
|
|
|
- }
|
|
|
- key={item}
|
|
|
- onClick={() => setActiveListItem(index)}
|
|
|
- >
|
|
|
- {item}
|
|
|
- </li>
|
|
|
- ))}
|
|
|
- </ul>
|
|
|
- </>
|
|
|
- );
|
|
|
+ return <ListGroup items={items} heading="Man shit list" />;
|
|
|
}
|
|
|
|
|
|
export default App;
|