Allow users to pass in a tag name prop to a component as a string.
JSXfunction Component(props) { const { as = 'div', children } = props; const Tag = as; return <Tag>{children}</Tag>; }
Last Updated:JSXexport default function App() { return ( <Component as="section"> { // ...rest components } </Component> ); }