diff --git a/webapp/channels/src/components/admin_console/filter/team_filter_dropdown/team_filter_checkbox.tsx b/webapp/channels/src/components/admin_console/filter/team_filter_dropdown/team_filter_checkbox.tsx index 48d3a88a5c..6dfce26a5a 100644 --- a/webapp/channels/src/components/admin_console/filter/team_filter_dropdown/team_filter_checkbox.tsx +++ b/webapp/channels/src/components/admin_console/filter/team_filter_dropdown/team_filter_checkbox.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; +import React, {useCallback} from 'react'; type Props = { id: string; @@ -11,36 +11,32 @@ type Props = { updateOption: (checked: boolean, name: string) => void; }; -class TeamFilterCheckbox extends React.PureComponent { - toggleOption = () => { - const {checked, id, updateOption} = this.props; +const TeamFilterCheckbox = ({ + id, + name, + checked, + label, + updateOption, +}: Props) => { + const toggleOption = useCallback(() => { updateOption(!checked, id); - }; + }, [checked, id, updateOption]); - render() { - const { - checked, - id, - label, - name, - } = this.props; + return ( +
+ -
- ); - } -} - -export default TeamFilterCheckbox; +export default React.memo(TeamFilterCheckbox);