Skip to content

Commit 65e3a52

Browse files
authored
Improve error message for missing Provider error (#7404)
1 parent 8217bd4 commit 65e3a52

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/@react-spectrum/provider/src/Provider.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ const ProviderWrapper = React.forwardRef(function ProviderWrapper(props: Provide
198198
export function useProvider() {
199199
let context = useContext(Context);
200200
if (!context) {
201-
throw new Error('No root provider found.');
201+
throw new Error(
202+
'No root provider found, please make sure your app is wrapped within a <Provider>. ' +
203+
'Alternatively, this issue may be caused by duplicate packages, see https://github.com/adobe/react-spectrum/wiki/Frequently-Asked-Questions-(FAQs)#why-are-there-errors-after-upgrading-a-react-spectrum-package for more information.'
204+
);
202205
}
203206
return context;
204207
}

0 commit comments

Comments
 (0)