import {
  ModulesContext,
  IModulesContext
} from 'components/ModulesProvider/ModulesProvider'
import { useContext } from 'react'

export const useModules = (): IModulesContext => {
  const context = useContext(ModulesContext)
  if (!context) {
    throw new Error('useModules Context must be used within a ModulesProvider')
  }
  return context
}
