import React, { createContext, useContext } from 'react' import { RJT_CONFIG } from '../core' const context = createContext(null) export const RJTProvider: React.FC<{ config: RJT_CONFIG, children: any }> = ({ config, children }) => { return ( {children} ) } export const useRJTConfig = (): RJT_CONFIG => { const config = useContext(context) if (config === null) { throw new Error('RJT is not configured, make sure to use this hook inside a RJTProvider !') } return config }