import React, { memo } from 'react';

interface IIfElseProps {
  if: boolean;
  else?: JSX.Element;
  children?: any;
}
export const IfElse = memo((props: IIfElseProps) => {
  const { children } = props;
  const ifCondition = props.if;
  const elseElement = props.else;
  return ifCondition ? <>{children}</> : elseElement || null;
});

IfElse.displayName = 'IfElse';
