Files
talk/client/coral-framework/hocs/excludeIf.js
T
2018-01-11 20:00:34 -07:00

19 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;
});