import { ElementType } from 'react';
import { useTitle } from '../../hooks';
import { IndexSignature } from '../../utils';

export const WithHocTitle = (
  Component: ElementType,
  title?: string,
  replace?: boolean
) => {
  return function WithHocTitleComponent(props: IndexSignature) {
    useTitle(title, replace);

    return (
      <Component
        {...props}
      />
    );
  };
};
