From a49a6a6a65f2eb96ba6cd6e2d0a0ceada6552e48 Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Thu, 11 Jul 2019 18:40:15 +0100 Subject: [PATCH] Use React.useContext instead of Context.Consumer --- .../select_import_method.jsx | 113 ++++++++---------- 1 file changed, 52 insertions(+), 61 deletions(-) diff --git a/assets/js/src/subscribers/importExport/import/step_method_selection/select_import_method.jsx b/assets/js/src/subscribers/importExport/import/step_method_selection/select_import_method.jsx index 1636a14166..19c7e0263c 100644 --- a/assets/js/src/subscribers/importExport/import/step_method_selection/select_import_method.jsx +++ b/assets/js/src/subscribers/importExport/import/step_method_selection/select_import_method.jsx @@ -8,69 +8,60 @@ function SelectImportMethod({ activeMethod, onMethodChange, }) { - const renderSelection = () => ( -
- {MailPoet.I18n.t('methodSelectionHead')} - - - -
+ const { isNewUser } = React.useContext(ImportContext); + const badgeClasses = classNames( + 'mailpoet_badge', + 'mailpoet_badge_video', + { mailpoet_badge_video_grey: !isNewUser } ); - return ( - - {({ isNewUser }) => { - const badgeClasses = classNames( - 'mailpoet_badge', - 'mailpoet_badge_video', - { mailpoet_badge_video_grey: !isNewUser } - ); - return ( - <> - {renderSelection()} - - - {MailPoet.I18n.t('seeVideo')} - - - ); - }} - + <> +
+ {MailPoet.I18n.t('methodSelectionHead')} + + + +
+ + + {MailPoet.I18n.t('seeVideo')} + + ); }