UNPKG

724 BJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import React from 'react';
3import SvgIcon from '../SvgIcon';
4/**
5 * Private module reserved for @material-ui/x packages.
6 */
7
8export default function createSvgIcon(path, displayName) {
9 const Component = (props, ref) => /*#__PURE__*/React.createElement(SvgIcon, _extends({
10 ref: ref
11 }, props), path);
12
13 if (process.env.NODE_ENV !== 'production') {
14 // Need to set `displayName` on the inner component for React.memo.
15 // React prior to 16.14 ignores `displayName` on the wrapper.
16 Component.displayName = `${displayName}Icon`;
17 }
18
19 Component.muiName = SvgIcon.muiName;
20 return /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(Component));
21}
\No newline at end of file