Files
talk/client/coral-framework/hocs/excludeIf.js
T
2017-09-29 23:33:37 +07:00

20 lines
445 B
JavaScript

import React from 'react';
import hoistStatics from 'recompose/hoistStatics';
/**
* ExcludeIf provides a property `emit: (eventName, value)`
* to the wrapped component.
*/
export default (condition) => hoistStatics((WrappedComponent) => {
class ExcludeIf extends React.Component {
render() {
return <WrappedComponent
{...this.props}
/>;
}
}
WrappedComponent.isExcluded = condition;
return ExcludeIf;
});