React.Children

import React from 'react';

type Props = {
  children: JSX.Element[] | JSX.Element;
  margin: number;
};

export default function Stack({ children, margin }: Props) {
  function wrapChildren() {
    return React.Children.map(children, (child) =>
      React.cloneElement(child, { style: { ...child.props.style, marginBottom: `${margin}px` } }),
    );
  }

  return <>{wrapChildren()}</>;
}
Surf Kid Bonanza