Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { useState } from "react";
const useCounter = initCount => {
const [count, setCount] = useState(initCount);
return [
count,
() => setCount(count => count + 1),
() => setCount(count => count - 1)
];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment