import React from 'react' ; import { useStore } from 'shared/libs/stores' ; import { Scp } from './scpContext' ; export const ScpContext = React . createContext < Scp | null > ( null ) ; export const ScpContextProvider = props => { return < ScpContext . Provider { ... props } / > ; } ; export default function useScpContext ( ) { const context = React . useContext < Scp > ( ScpContext ) ; useStore ( context . store ) ; if ( ! context ) { throw new Error ( 'ScpContext is missing a context' ) ; } return context ; }