Use React.useContext instead of Context.Consumer
This commit is contained in:
committed by
M. Shull
parent
a327d7f80a
commit
a49a6a6a65
@@ -8,7 +8,14 @@ function SelectImportMethod({
|
||||
activeMethod,
|
||||
onMethodChange,
|
||||
}) {
|
||||
const renderSelection = () => (
|
||||
const { isNewUser } = React.useContext(ImportContext);
|
||||
const badgeClasses = classNames(
|
||||
'mailpoet_badge',
|
||||
'mailpoet_badge_video',
|
||||
{ mailpoet_badge_video_grey: !isNewUser }
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<form className="mailpoet_import_selection_form">
|
||||
<span className="mailpoet_import_heading">{MailPoet.I18n.t('methodSelectionHead')}</span>
|
||||
<label htmlFor="import-paste-method">
|
||||
@@ -45,19 +52,6 @@ function SelectImportMethod({
|
||||
{MailPoet.I18n.t('methodMailChimp')}
|
||||
</label>
|
||||
</form>
|
||||
);
|
||||
|
||||
return (
|
||||
<ImportContext.Consumer>
|
||||
{({ isNewUser }) => {
|
||||
const badgeClasses = classNames(
|
||||
'mailpoet_badge',
|
||||
'mailpoet_badge_video',
|
||||
{ mailpoet_badge_video_grey: !isNewUser }
|
||||
);
|
||||
return (
|
||||
<>
|
||||
{renderSelection()}
|
||||
<a
|
||||
className={badgeClasses}
|
||||
href="https://kb.mailpoet.com/article/242-video-guide-importing-subscribers-using-a-csv-file"
|
||||
@@ -69,9 +63,6 @@ function SelectImportMethod({
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
}}
|
||||
</ImportContext.Consumer>
|
||||
);
|
||||
}
|
||||
|
||||
SelectImportMethod.propTypes = {
|
||||
|
Reference in New Issue
Block a user