1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2025-02-16 20:53:57 +00:00
pds-2021-g2-nest/nest_frontend/hooks/useRepositoryEditor.js

14 lines
407 B
JavaScript
Raw Normal View History

2021-04-29 16:58:31 +02:00
import { useContext } from "react"
import ContextRepositoryEditor from "../contexts/ContextConditionEditor"
2021-04-29 16:58:31 +02:00
/**
2021-05-18 16:57:43 +02:00
* Hook to quickly use {@link ContextRepositoryEditor}.
2021-04-29 16:58:31 +02:00
*/
export default function useRepositoryEditor() {
const context = useContext(ContextRepositoryEditor)
if(!context) {
2021-05-18 15:16:43 +02:00
throw new Error("This component must be placed inside a RepositoryEditor.")
2021-04-29 16:58:31 +02:00
}
return context
}