Advertisement
Diego_Frenoux

Pa' el santi

Dec 3rd, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. import ReactDOM from "react-dom";
  3.  
  4. import "./styles.css";
  5.  
  6. const btnEmpezar = document.getElementById("btnEmpezar");
  7.  
  8. class JuegoJS {
  9.   constructor() {
  10.     this.inicializar = this.inicializar.bind(this);
  11.     this.inicializar();
  12.   }
  13.  
  14.   inicializar() {
  15.     // codigo
  16.   }
  17.  
  18.   siguienteNivel() {
  19.     // codigo  
  20.   }
  21.  
  22.   ganoElJuego() {
  23.     console.log("GANASTE")
  24.   }
  25.  
  26.   perdioElJuego() {
  27.     console.log("PERDISTE")
  28. }
  29. }
  30. const juego = new JuegoJS()
  31.  
  32. function App() {
  33.   return <button
  34.   id="btnEmpezar"
  35.   className="btn-start"
  36.   onClick={juego.inicializar()}>
  37.   Empezar a jugar!
  38. </button>;
  39. }
  40.  
  41. const rootElement = document.getElementById("root");
  42. ReactDOM.render(<App />, rootElement);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement