From 1d1c09bcdd104adf7188b7a13dd2a00bf4442a4f Mon Sep 17 00:00:00 2001 From: tuanvu Date: Fri, 29 Nov 2024 14:39:11 +0100 Subject: [PATCH] q1 --- src/App.tsx | 22 +++++++--------------- src/Beer.tsx | 10 ++++++++++ src/BeerList.tsx | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 src/Beer.tsx create mode 100644 src/BeerList.tsx diff --git a/src/App.tsx b/src/App.tsx index a53698a..91a7922 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,26 +1,18 @@ import React from 'react'; import logo from './logo.svg'; import './App.css'; +import BeerList from './BeerList'; function App() { + const FavoriteBeers = ["Coreoff","Corona","Mort Subite"] + return (
-
- logo -

- Edit src/App.tsx and save to reload. -

- - Learn React - -
+
+ + ); } -export default App; +export default App; \ No newline at end of file diff --git a/src/Beer.tsx b/src/Beer.tsx new file mode 100644 index 0000000..a720452 --- /dev/null +++ b/src/Beer.tsx @@ -0,0 +1,10 @@ +import * as React from 'react'; + +interface BeerProps{ + name: string; +}; + +const Beer: React.FunctionComponent = (props)=> { + return
{props.name}
+}; +export default Beer; \ No newline at end of file diff --git a/src/BeerList.tsx b/src/BeerList.tsx new file mode 100644 index 0000000..2d914b2 --- /dev/null +++ b/src/BeerList.tsx @@ -0,0 +1,20 @@ +import * as React from 'react'; +import Beer from './Beer'; + +interface BeerListProps{ + beers: string[]; +}; + +const BeerList: React.FunctionComponent= (props)=> { + return( +
+

Liste de vos bières préférées

+
    {props.beers.map((beer,index)=> ( + + ))} +
+
+ ); +}; + +export default BeerList; \ No newline at end of file