import { noop , omit } from 'lodash-unified' ; import { createContext , useContext } from 'react' ; import type { FileInfo } from '../../types' ; export interface Props { onInsert ( info ) : void ; onUploading ( enabled ) : void ; } const Context = createContext < Props > ( { onInsert : noop , onUploading : noop , } ) ; export const Exchange = ( props ) => ( < Context . Provider value = { omit ( props , [ 'children' ] ) } children = { props . children } / > ) ; export const useExchange = ( ) => useContext ( Context ) ;