Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

378
Views
Los detectores de eventos onClick no funcionan en Remix

En mi aplicación Remix, intento mostrar de forma condicional un widget de interfaz de usuario, según el valor de una variable de estado. Aquí está mi código.

 import { useState } from "react"; import type { LinksFunction } from "remix"; import stylesUrl from "../styles/index.css"; export const links: LinksFunction = () => { return [ { rel: "stylesheet", href: stylesUrl } ]; }; export default function Index() { const [isMenuOpen,setMenuOpen] = useState(false) function toggleNav(){ window.alert("hh") // no alert is shown console.log("hi") // no console statement is printed setMenuOpen(!isMenuOpen) } return ( <div className="landing"> <button onClick={toggleNav}>test</button> </div> ); }

Sin embargo, la función toggleNav no parece activarse al hacer clic en el botón. No pude ver ninguna alerta o salida en la consola.

No podía entender por qué no funciona. Sería genial, si alguien me puede señalar lo que estoy haciendo mal aquí. TIA.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Asegúrese de que está procesando el componente Scripts de Remix en la ruta raíz; sin él, su aplicación no cargará ningún lado del cliente JS.

Ver https://remix.run/docs/en/v1/api/remix#meta-links-scripts

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!