mirror of
https://github.com/plausible/analytics.git
synced 2024-12-30 13:03:23 +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>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|