You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
442 B
26 lines
442 B
6 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React from 'react';
|
||
|
|
||
|
function withCurrentPage(WrappedComponent) {
|
||
|
function CurrentPage(props) {
|
||
|
const {
|
||
|
history
|
||
|
} = props;
|
||
|
|
||
|
return (
|
||
|
<WrappedComponent
|
||
|
{...props}
|
||
|
useCurrentPage={history.action === 'POP'}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
CurrentPage.propTypes = {
|
||
|
history: PropTypes.object.isRequired
|
||
|
};
|
||
|
|
||
|
return CurrentPage;
|
||
|
}
|
||
|
|
||
|
export default withCurrentPage;
|