1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-23 05:24:18 +00:00
pds-2021-g2-nest/nest_frontend/hooks/useRepositoryEditor.js
2021-05-18 17:51:43 +02:00

14 lines
No EOL
408 B
JavaScript

import { useContext } from "react"
import ContextRepositoryEditor from "../contexts/ContextRepositoryEditor"
/**
* Hook to quickly use {@link ContextRepositoryEditor}.
*/
export default function useRepositoryEditor() {
const context = useContext(ContextRepositoryEditor)
if(!context) {
throw new Error("This component must be placed inside a RepositoryEditor.")
}
return context
}