• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mints-components / hooks / 13319939355

14 Feb 2025 12:36AM UTC coverage: 96.569% (-0.2%) from 96.809%
13319939355

push

github

mintsweet
feat: add a new hook useQueryParams

62 of 68 branches covered (91.18%)

Branch coverage included in aggregate %.

15 of 16 new or added lines in 2 files covered. (93.75%)

135 of 136 relevant lines covered (99.26%)

13.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/src/use-toggle.ts
1
import { useState } from 'react';
16✔
2

3
export const useToggle = <T, U>(
16✔
4
  defaultState: T = false as T,
3✔
5
  reverseState?: U,
6
): [T | U, () => void] => {
7
  const [state, setState] = useState<T | U>(defaultState);
10✔
8

9
  const toggle = () => {
10✔
10
    setState((prev) =>
4✔
11
      prev === defaultState
4!
12
        ? (reverseState ?? (!defaultState as U))
6✔
13
        : defaultState,
14
    );
15
  };
16

17
  return [state, toggle];
10✔
18
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc