From 4ae047e4d82e31573cd3bddca52f3a2cd6394f49 Mon Sep 17 00:00:00 2001 From: Felix Beceic Date: Mon, 6 Mar 2023 09:14:19 +0100 Subject: [PATCH] #65 Refactor useIntlContext --- libs/intl/src/useIntlContext.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/intl/src/useIntlContext.tsx b/libs/intl/src/useIntlContext.tsx index 365be56..5ff5fdb 100644 --- a/libs/intl/src/useIntlContext.tsx +++ b/libs/intl/src/useIntlContext.tsx @@ -1,12 +1,12 @@ import * as React from "react"; -import { IntlContext } from "./IntlProvider"; +import { IntlContext, IntlContextType } from "./IntlProvider"; export function useIntlContext() { const context = React.useContext(IntlContext); if (!context) { - throw new Error("useIntlContext must be used within a IntlProvider"); + return null as unknown as IntlContextType; } return context;