import type { FC, ReactNode } from "react";
import { useMemo } from "react";
import type { IFormatText } from "./config/types";
import { getFormattedChildren } from "./lib";
import type { IComponentBaseProps } from "../../types/index";

/**
 * Компонент форматированного текста
 * @returns {ReactNode}
 */
const FormatText: FC<IFormatText & IComponentBaseProps> = ({ children }): ReactNode => {
  return useMemo(() => {
    return getFormattedChildren(children);
  }, [ children ]);
};


export type { IFormatText };
export { FormatText };
