Context provider "provides" the context to all it's children no matter how deep they are. Since Button was outside the provider and not a children of provider, it wasn't able to identify which "context" you're talking when you said useContext inside the custom hook.
Always make sure that the component which is using "context" is inside the context "Provider"