JSFiddle - React, Tailwind, and code Playground

HTML

<form>
<input type="checkbox" id="checkall" name="check_all" />

<input type="checkbox" name="department[]" class="department" value="" checked = "checked" />
    
    <input type="reset" name="reset" />
</form>

JavaScript

$(function(){
    $("#checkall").click(function(){
        if($(this).prop('checked')){
            $(".department").prop('checked', true);
        }else{
            $(".department").prop('checked', false);
        }
    });
});