mirror of
https://github.com/plausible/analytics.git
synced 2024-12-21 08:31:29 +03:00
17 lines
473 B
JavaScript
17 lines
473 B
JavaScript
|
import React from 'react';
|
||
|
import { ComparisonContext } from './comparison-context'
|
||
|
|
||
|
export const withComparisonConsumer = (WrappedComponent) => {
|
||
|
return class extends React.Component {
|
||
|
render() {
|
||
|
return (
|
||
|
<ComparisonContext.Consumer>
|
||
|
{({data, modifyComparison}) => (
|
||
|
<WrappedComponent comparison={data} modifyComparison={modifyComparison} {...this.props} />
|
||
|
)}
|
||
|
</ComparisonContext.Consumer>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|