@gechiui/components
Version:
UI components for GeChiUI.
26 lines (21 loc) • 453 B
text/typescript
/**
* GeChiUI dependencies
*/
import { useContext } from '@gechiui/element';
/**
* Internal dependencies
*/
import { NavigatorContext } from './context';
import type { Navigator } from './types';
/**
* Retrieves a `navigator` instance.
*/
function useNavigator(): Navigator {
const [ , setPath ] = useContext( NavigatorContext );
return {
push( path, options ) {
setPath( { path, ...options } );
},
};
}
export default useNavigator;