Skip to content

Commit

Permalink
ensure Icon exists
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Aug 26, 2022
1 parent d1c85ca commit 47cb370
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/material/src/components/IconButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import PropTypes from 'prop-types';

export default function IconButton({ icon, ...rest }) {
const Icon = useIcon(icon);
if (!Icon) {
throw new Error(`"${icon}" is not a registered icon!`);
}
return (
<MuiIconButton {...rest}>
<Icon />
Expand Down

0 comments on commit 47cb370

Please sign in to comment.