Created
November 18, 2024 12:45
-
-
Save siddharta1337/eebc08ce77bb9dbad37b61d009dc01c4 to your computer and use it in GitHub Desktop.
Ejemplo de componente React
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from "react"; | |
| const ContadorDeClicks = () => { | |
| const [contador, setContador] = useState(0); | |
| const manejarClick = () => { | |
| setContador(contador + 1); | |
| }; | |
| return ( | |
| <div style={{ textAlign: "center", marginTop: "20px" }}> | |
| <h1>Contador de Clics</h1> | |
| <p>Has hecho clic {contador} veces</p> | |
| <button onClick={manejarClick}>Guardar</button> | |
| </div> | |
| ); | |
| }; | |
| export default ContadorDeClicks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from "react"; | |
| const ContadorDeClicks = () => { | |
| const [contador, setContador] = useState(0); | |
| const manejarClick = () => { | |
| setContador(contador + 1); | |
| }; | |
| return ( | |
| <div style={{ textAlign: "center", marginTop: "20px" }}> | |
| <h1>Contador de Clics</h1> | |
| <p>Has hecho clic {contador} veces</p> | |
| <button onClick={manejarClick}>Guardar</button> | |
| </div> | |
| ); | |
| }; | |
| export default ContadorDeClicks; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment