import React from 'react'; const Blank = ({ children }) => children || null; export const compose = (...components: any[]) => { const Root = [...components, Blank].reduce((parent, child) => { const [Parent, parentProps] = Array.isArray(parent) ? parent : [parent]; const [Child, childProps] = Array.isArray(child) ? child : [child]; return ({ children }) => ( {children} ); }); return (LastChild?: any) => (props?: any) => { return {LastChild && }; }; };