How should we be using Flow type annotations with react hooks, such as useState? I've tried searching for some examples of how they should be implemented, but can't find anything.
I tried this:
const [allResultsVisible, setAllResultsVisible]: [ boolean, (boolean) => void, ] = useState(false);
Which doesn't throw any flow related errors, but I'm not sure if this is correct or the best way to annotate the hook. If my attempt isn't correct or the best way, what should I do instead?
useState(false)(like TypeScript does), and wouldn't need annotations at all. - ᆼᆺᆼconst [loading, setLoading] = useState<boolean>(true);- rkb