diff --git a/core/lib/Drupal/Core/Render/Element/RenderElementBase.php b/core/lib/Drupal/Core/Render/Element/RenderElementBase.php
index 0ba624f743c037a7489fd7b489ad98940eac4d77..84230b5c14f0e7ee577f69bb8acb5ad4d94f5c85 100644
--- a/core/lib/Drupal/Core/Render/Element/RenderElementBase.php
+++ b/core/lib/Drupal/Core/Render/Element/RenderElementBase.php
@@ -374,6 +374,7 @@ public static function preRenderAjaxForm($element) {
 
       // @todo Legacy support. Remove in Drupal 8.
       if (isset($settings['method']) && $settings['method'] == 'replace') {
+        @trigger_error('Using "replace" as the method in #ajax property is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use "replaceWith" instead. See https://www.drupal.org/project/drupal/issues/3303557', E_USER_DEPRECATED);
         $settings['method'] = 'replaceWith';
       }
 
diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php
index 3774d3c57551f0fb71a3839c260363d2744efe14..b63f48144a11b4fbcd6fe2462ce0d21702ec69f0 100644
--- a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php
+++ b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php
@@ -31,7 +31,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#ajax' => [
         'callback' => 'ajax_forms_test_validation_form_callback',
         'wrapper' => 'message_area',
-        'method' => 'replace',
+        'method' => 'replaceWith',
       ],
       '#suffix' => '<div id="message_area"></div>',
     ];
@@ -44,7 +44,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#ajax' => [
         'callback' => 'ajax_forms_test_validation_number_form_callback',
         'wrapper' => 'message_area_number',
-        'method' => 'replace',
+        'method' => 'replaceWith',
       ],
       '#suffix' => '<div id="message_area_number"></div>',
     ];
diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php
index 63350a65fc2aaaa41c9b89e43dcd5dcb54b12233..cb854c4b7bf0d28365c59ed11e0d70d24cf70d84 100644
--- a/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php
+++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php
@@ -77,7 +77,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#ajax' => [
         'callback' => '::buildAjaxSnackConfigureForm',
         'wrapper' => 'snack-config-form',
-        'method' => 'replace',
+        'method' => 'replaceWith',
         'effect' => 'fade',
       ],
     ];