commiteado codigo funcionando
This commit is contained in:
26
src/Components/Alumno.tsx
Normal file
26
src/Components/Alumno.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import "./Alumno.css"
|
||||
|
||||
export default function Alumno(){
|
||||
const [alumno, setAlumno] = useState({ presente: false });
|
||||
return (
|
||||
<div id="aa"
|
||||
className = {`alumno b ${alumno.presente ? "b-rojo" : "b-verde"}`}
|
||||
>
|
||||
{(alumno.presente === true ? (
|
||||
<p>
|
||||
Presente
|
||||
</p>
|
||||
) : (
|
||||
<p>
|
||||
Ausente
|
||||
</p>
|
||||
))}
|
||||
<button onClick={() =>setAlumno({
|
||||
presente: alumno.presente ? false: true
|
||||
})}>
|
||||
toggle
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user