I think this post should have a disclaimer at the top: "Please don't use this in production code"
On the other hand, void is useful when you are writing one-liners for hooks in React, because React will throw an error if you don't return a function or null: useEffect(() => void setTimeout(myfunction, sometime))
I think this post should have a disclaimer at the top: "Please don't use this in production code"
On the other hand, void is useful when you are writing one-liners for hooks in React, because React will throw an error if you don't return a function or null:
useEffect(() => void setTimeout(myfunction, sometime))
void is also useful if you write switch statements like this:
You can reduce a couple of lines using them this way while maintaining the exact behavior: