mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 21:14:18 +00:00
15 lines
482 B
JavaScript
15 lines
482 B
JavaScript
|
import { useContext } from "react"
|
||
|
import ContextRepositoryEditor from "../contexts/ContextRepositoryEditor"
|
||
|
import ContextRepositoryViewer from "../contexts/ContextRepositoryViewer"
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Hook to quickly use {@link ContextRepositoryEditor}.
|
||
|
*/
|
||
|
export default function useRepositoryEditor() {
|
||
|
const context = useContext(ContextRepositoryViewer)
|
||
|
if(!context) {
|
||
|
throw new Error("This component must be placed inside a RepositoryViewer.")
|
||
|
}
|
||
|
return context
|
||
|
}
|