JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://gitcdn.github.io/bootstrap-toggle/2.2.0/css/bootstrap-toggle.min.css">
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.0/js/bootstrap-toggle.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<input type="checkbox" class="toggleSwitch chkAll" name="chkAll" data-toggle="toggle">
<br/>
<input type="checkbox" class="toggleSwitch chkOne" name="chk1" data-toggle="toggle">
<input type="checkbox" class="toggleSwitch chkOne" name="chk2" data-toggle="toggle">
<input type="checkbox" class="toggleSwitch chkOne" name="chk3" data-toggle="toggle">
JavaScript
$(function(){
$('.chkAll').on('change', function(){
var thisValue = $(this).prop('checked');
alert('chkAll change '+thisValue);
$('.chkOne').prop('checked', thisValue).change();
});
$('.chkOne').on('change', function(){
var thisValue = $(this).prop('checked');
var thisName = $(this).attr('name');
alert('chkOne change '+thisName+thisValue);
});
});