m3-academy-template-vtexio-.../custom/react/components/UI/ResponsiveRender/ResponsiveRender.tsx
Caroline Moran f2a03c53ae first commit
2022-08-11 09:06:07 -04:00

21 lines
525 B
TypeScript

import React from "react";
import useResponsiveValidator, { screen_type, validation_type } from "../../../hooks/useResponsiveValidator";
interface ResponsiveRenderProps {
children: JSX.Element[],
type: validation_type
width: screen_type,
}
const ResponsiveRender = ({ children, type, width}: ResponsiveRenderProps): JSX.Element => {
const canRender = useResponsiveValidator({type, width});
return(
<>
{canRender ? children : <></>}
</>
);
};
export default ResponsiveRender;