Skip to content

Commit

Permalink
fix(notification bar): add react memo to replace shouldcomponentupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
ekowidianto committed Mar 17, 2022
1 parent f30bd2f commit 0714d3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ exports[`<MaterialList /> renders the component with materials 1`] = `
</ReactTooltip>
</WithStyles(List)>
<WithStyles(Divider) />
<NotificationBar
<Memo(NotificationBar)
autoHideDuration={5000}
/>
</Fragment>
Expand Down
5 changes: 4 additions & 1 deletion client/app/lib/components/NotificationBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ NotificationBar.propTypes = {
autoHideDuration: PropTypes.number,
};

export default NotificationBar;
export default React.memo(
NotificationBar,
(prevProps, nextProps) => prevProps.notification === nextProps.notification,
);

0 comments on commit 0714d3a

Please sign in to comment.