Implement useToggle(initial) that returns [getValue, toggle, setValue]:
getValue() — returns the current boolean.toggle() — flips the boolean.setValue(v) — sets to an explicit boolean.solve(initial, ops) drives the hook and returns the state after each op.
Ops: { type: 'toggle' } or { type: 'set', value: boolean }.
Sample tests