diff --git a/web/modals/account/verification-modal.react.js b/web/modals/account/verification-modal.react.js
index b15b46734..495334e7c 100644
--- a/web/modals/account/verification-modal.react.js
+++ b/web/modals/account/verification-modal.react.js
@@ -1,54 +1,66 @@
// @flow
import invariant from 'invariant';
import * as React from 'react';
import {
type ServerVerificationResult,
verifyField,
} from 'lib/types/verify-types';
-import { connect } from 'lib/utils/redux-utils';
-import type { AppState } from '../../redux/redux-setup';
+import { useSelector } from '../../redux/redux-utils';
import css from '../../style.css';
import Modal from '../modal.react';
-type Props = {
- onClose: () => void,
- // Redux state
- serverVerificationResult: ?ServerVerificationResult,
-};
+type BaseProps = {|
+ +onClose: () => void,
+|};
+type Props = {|
+ ...BaseProps,
+ +serverVerificationResult: ?ServerVerificationResult,
+|};
function VerificationModal(props: Props) {
const { onClose, serverVerificationResult } = props;
invariant(
serverVerificationResult,
'VerificationModal needs a serverVerificationResult',
);
const { success } = serverVerificationResult;
let message, title;
if (!success) {
title = 'Invalid code';
message = 'Sorry, but that code has expired or is invalid.';
} else if (success && serverVerificationResult.field === verifyField.EMAIL) {
title = 'Verified email';
message = 'Thanks for verifying your email address!';
}
invariant(
title && message,
"VerificationModal can't handle serverVerificationResult " +
JSON.stringify(serverVerificationResult),
);
return (
);
}
-export default connect((state: AppState) => ({
- serverVerificationResult: state.serverVerificationResult,
-}))(VerificationModal);
+export default React.memo(function ConnectedVerificationModal(
+ props: BaseProps,
+) {
+ const serverVerificationResult = useSelector(
+ (state) => state.serverVerificationResult,
+ );
+
+ return (
+
+ );
+});