@atlaskit/side-navigation
Version:
A highly composable side navigation component that supports nested views.
18 lines (17 loc) • 587 B
JavaScript
import { useContext } from 'react';
import { NestedContext } from './nested-context';
export const useNestedContext = () => {
const context = useContext(NestedContext);
if (!context) {
let error = '';
if (process.env.NODE_ENV === 'development') {
error = `
To use a <NestingItem /> it needs to be a descendant of <NestableNavigationContent>.
You probably need to replace your <NavigationContent> with <NestableNavigationContent>.
import { NestableNavigationContent } from '@atlaskit/side-navigation';
`;
}
throw new Error(error);
}
return context;
};