mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 06:47:33 +08:00
19 lines
445 B
JavaScript
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;
|
|
});
|