Add imageErrorAs to icon#4009
Conversation
| className: 'ms-Check-check ' + styles.check, | ||
| iconName: 'StatusCircleCheckmark' | ||
| }) } | ||
| { <Icon |
There was a problem hiding this comment.
The original intent here was that because Check is a hotspot, calling the stateless component directly was a performance optimization. I think the perf optimization is dated though, so I think this is fine.
I made a codepen to test the theory about if JSX or function calls are faster. They look pretty comparable.
There was a problem hiding this comment.
That's for creation, is there also a management overhead later when removing etc?
There was a problem hiding this comment.
The example also has a "clear" button which also measures, and I didn't see a noticeable impact.
|
/home/travis/build/OfficeDev/office-ui-fabric-react/packages/office-ui-fabric-react/src/components/Button/BaseButton.tsx:257:14 Make sure to run |
| classNames.imageContainer, | ||
| className | ||
| ); | ||
| export class Icon extends React.Component<IIconProps, IIconState> { |
There was a problem hiding this comment.
This probably should BaseComponent
| /** | ||
| * If rendering an image icon, this function callback will be invoked in the event loading the image errors. | ||
| */ | ||
| imageErrorAs?: (image: IImageProps) => any; |
There was a problem hiding this comment.
instead of any, can you make this type safe? Let me see;
React.StatelessComponent<IImageProps> | React.ComponentClass<IImageProps>I think that's it?
Pull request checklist
$ npm run changeDescription of changes