Loading homepage
Input: useCounter() Output: count is 0 on the first render.
Input: useCounter(5); then increment(); increment() in one event Output: count is 7 after the next render.
Input: setCount((previous) => previous * 2) Output: The current count is doubled after the next render.
Input: useCounter(5); then setCount(99); reset() Output: count returns to 5.
useCounter(initialValue?) returns numeric count plus four void-returning utility methods. setCount accepts a number or numeric updater; the other methods take no arguments. State is visible on the next React render. TypeScript exports UseCounterResult.