I am using HeroIcons for Next.Js app but get conscious about how they organised their package architecture. They are returning icons like this:
const React = require("react");
function ArchiveIcon(props, svgRef) {
return /*#__PURE__*/React.createElement("svg", Object.assign({
xmlns: "http://www.w3.org/2000/svg",
fill: "none",
viewBox: "0 0 24 24",
strokeWidth: 2,
stroke: "currentColor",
"aria-hidden": "true",
ref: svgRef
}, props), /*#__PURE__*/React.createElement("path", {
strokeLinecap: "round",
strokeLinejoin: "round",
d: "M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"
}));
}
const ForwardRef = React.forwardRef(ArchiveIcon);
module.exports = ForwardRef;
but my question is why can't they just return like this:
function ArchiveIcon({className}) {
return <svg className={className} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<path
fill="#000"
fillRule="evenodd"
d="M11.353 2H2v9.334L12.66 22 22 12.653 11.353 2zm-7.242 8.459V4.112h6.368l8.536 8.542-6.356 6.359-8.548-8.554zm4.096-2.252v-2.07h-2.07v2.07h2.07z"
clipRule="evenodd"
></path>
</svg>
};
Instead of using **React.CreateElement('svg')** and creating a new Dom Element?