diff --git a/src/App.tsx b/src/App.tsx index 3ad0baa..e0ac47d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,13 @@ import ListGroup from "./components/ListGroup"; function App() { - return
; + let items = ["New York", "San Francisco", "Tokyo", "London"]; + + return ( +
+ +
+ ); } -export default App; \ No newline at end of file +export default App; diff --git a/src/components/ListGroup.tsx b/src/components/ListGroup.tsx index 19d1dcc..f815104 100644 --- a/src/components/ListGroup.tsx +++ b/src/components/ListGroup.tsx @@ -1,13 +1,17 @@ import { useState } from "react"; +// {items: [string], heading: string} +interface Props { + items: string []; + heading: string; +} -function ListGroup() { - let items = ["New York", "San Francisco", "Tokyo", "London"]; +function ListGroup({items, heading}: Props) { const [selectedIndex, setSelectedIndex] = useState(-1); return ( <> -

List Name

+

{heading}

{items.length === 0 &&

No items found

}