UNPKG

370 BTypeScriptView Raw
1import * as React from 'react';
2
3import PreventRemoveContext from './PreventRemoveContext';
4
5export default function usePreventRemoveContext() {
6 const value = React.useContext(PreventRemoveContext);
7
8 if (value == null) {
9 throw new Error(
10 "Couldn't find the prevent remove context. Is your component inside NavigationContent?"
11 );
12 }
13
14 return value;
15}