With the new Hooks API added in v7.1.0, you can get rid of the variable and mapDispatchToProps
altogether:
import { useDispatch } from 'react-redux'
import { setFilter } from '../actions/filter';
function FilterButton() {
const dispatch = useDispatch()
return (
);
}
export default FilterButton;