import React from 'react';
import { useHistory } from 'react-router-dom';

/**
 * 类组件使用这个高阶组件包裹拿到history对象
 */
const connectHistoryHoc = Wraper => props => {
  const history = useHistory();
  return <Wraper {...props} history={history} />;
};

export default connectHistoryHoc;
