import React from "react" ; import { compose , hoistStatics , InferableComponentEnhancer , wrapDisplayName , } from "recompose" ; import { Environment } from "relay-runtime" ; import { CoralContext , withContext } from "../bootstrap" ; deprecated function createMutationContainer < T extends string , I , R > ( propName , commit ) { return compose ( withContext ( ( context ) => ( { context } ) ) , hoistStatics ( ( BaseComponent ) => { class CreateMutationContainer extends React . Component < { context : CoralContext ; } > { public static displayName = wrapDisplayName ( BaseComponent , "createMutationContainer" ) ; private commit = ( input ) => { this . props . context . eventEmitter . emit ( `mutation.${ propName }` , input ) ; return commit ( this . props . context . relayEnvironment , input , this . props . context ) ; } ; public render ( ) { const { context : _ , ... rest } = this . props ; const inject = { [ propName ] : this . commit , } ; return < BaseComponent { ... rest } { ... inject } />; } } return CreateMutationContainer as React . ComponentClass < any > ; } ) ) as any ; } export default createMutationContainer ;