JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" /> One
<br />
<input type="checkbox" /> Two
<br />
<input type="checkbox" /> Three
<br />
<button onclick="toggle()" >Check all</button>

JavaScript

var new_state = true;
function toggle()
{
	$('input').attr("checked", new_state);
    
    new_state = ! new_state;
}