Check out example codes for "select all checkbox rails". It will help you in understanding the concepts better.

Code Example 1

   $('#check_all').on("click", function() {
     // grouping all the checkbox using the classname
     var checkboxes = $("class name for the checkbox");
     // check whether checkboxes are selected.
        // if they are selected, unchecking all the checkbox
     } else {
        // if they are not selected, checking all the checkbox

Learn ReactJs, React Native from