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