Skip to content
Snippets Groups Projects
Commit cd037ee6 authored by Viarezo's avatar Viarezo
Browse files

first bare version

parent c43347fa
No related branches found
No related tags found
No related merge requests found
import './App.css';
import { Counter } from './Counter';
import { default as Grid } from './Grid.js';
const App = () => {
const compteurs = []
for (let pas = 0; pas < 5; pas++) {
compteurs.push(<Counter title={"Le compteur n° "+String(pas)}/>)
}
return (
<div>
<div className="App">
......@@ -14,9 +7,6 @@ const App = () => {
<h1>Bienvenue sur notre super site !</h1>
</div>
</div>
<Grid>
{compteurs}
</Grid>
</div>
);
}
......
import { useState } from "react";
const Counter = (props) => {
const [count, setCount] = useState(0);
return (
<div class="card" style={{width:"auto", margin: '2em'}}>
<div class="card-header">
{props.title}
</div>
<button
type="button"
class="btn btn-primary"
onClick={()=>setCount(count+1)}
style={{margin: "1em"}}
>
Ce bouton incrémente
</button>
<p style={{margin: "1em auto"}}> genre ça vaut {count}</p>
</div>
)
};
export { Counter };
\ No newline at end of file
import './grid.css';
const Grid = (props) => (
<div class="grid">
{props.children}
</div>
)
export default Grid
\ No newline at end of file
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment