Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

194
Visualizações
can't connect ToggleSwitch button to firebase

**i'm trying to make connection between firebase and toggle switch button in reactjs app to do specific action but nothing appear like child or new element in firebase enter image description here**n

import jQuery from 'jquery';
import  firebase from 'firebase';



  export default function ToggleSwitch_temp() {
    
  
  jQuery(document).on(function(){
      var database = firebase.database();
    var Led1Status;
  
    database.ref().on("value", function(snap){
      Led1Status = snap.val().Led1Status;
      
      jQuery(".toggleSwitch").on(function(){
        let firebaseRef = firebase.database().ref().child("Led1Status");
    
        if(Led1Status === "1"){    // post to firebase
          firebaseRef.set("0");
          Led1Status = "0";
        } else {
          firebaseRef.set("1");
          Led1Status = "1";
        }
      })
    });
   
      
      }
    );
  

    return (
      <div className="toggle-switch">
        <input
          type="checkbox"
          className="toggle-switch-checkbox"
          name="toggleSwitch"
          id="toggleSwitch"
        />
        <label className="toggle-switch-label" htmlFor="toggleSwitch">
          <span className="toggle-switch-inner" />
          <span className="toggle-switch-switch" />
        </label>
      </div>
    );
  
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda