passing children step-1

main
Gerardo Marx 2 weeks ago
parent 9cd6f1ebcc
commit 4c9416b1b3

@ -1,15 +1,10 @@
import ListGroup from "./components/ListGroup"; import Alert from "./components/Alert";
function App() {
let items = ["New York", "San Francisco", "Tokyo", "London"];
const handleSelectItem = (item: string) => {
console.log(item)
}
function App() {
return ( return (
<div> <div>
<ListGroup items={items} heading="Cities" onSelectItem={handleSelectItem}/> <Alert text="Hello Marx"/>
</div> </div>
); );
} }

@ -0,0 +1,11 @@
interface Props{
text: string;
}
function Alert({text} : Props) {
return (
<div className="alert alert-primary">{text}</div>
)
}
export default Alert
Loading…
Cancel
Save