diff --git a/core/includes/common.inc b/core/includes/common.inc
index 9601c76..a5bed87 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4007,8 +4007,7 @@ function drupal_pre_render_scripts($elements) {
 
   // Since JavaScript may look for arguments in the URL and act on them, some
   // third-party code might require the use of a different query string.
-  $js_version_string = variable_get('drupal_js_version_query_string', 'v=');
-
+  $js_version_string = state()->get('system.js_version_query_string') ?: 'v=';
   // Defaults for each SCRIPT element.
   $element_defaults = array(
     '#type' => 'html_tag',
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 4bced68..8586c16 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -2202,6 +2202,18 @@ function system_update_8032() {
 }
 
 /**
+ * Convert drupal_js_version_query_string variable to state API.
+ *
+ * @ingroup state_upgrade
+ */
+function system_update_8033() {
+  if ($value = update_variable_get('drupal_js_version_query_string', FALSE)) {
+    state()->set('system.js_version_query_string', $value);
+  }
+  update_variable_del('drupal_js_version_query_string');
+}
+
+/**
  * @} End of "defgroup updates-7.x-to-8.x".
  * The next series of updates should start at 9000.
  */
