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

197
Views
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
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!