import React, { createElement } from 'react'; import { Button } from 'antd'; import styles from './index.less'; interface EditableLinkGroupProps { links: any[]; onAdd: () => void; linkElement: string; } const EditableLinkGroup: React.FC = props => { const { links = [], linkElement = 'a', onAdd = () => {} } = props; return (
{links.map(link => createElement( linkElement, { key: `linkGroup-item-${link.id || link.title}`, to: link.href, href: link.href, }, link.title, ), )} { }
); }; export default EditableLinkGroup;