---
title: "Upgrade JSS apps to JSS 22.4"
slug: "upgrade-jss-apps-to-jss-22-4"
abstract: "How to upgrade your JavaScript Rendering SDKs to version 22.4 to benefit from the latest improvements."
---
# Upgrade JSS apps to JSS 22.4

Sitecore JavaScript Rendering SDK version 22.4 requires you to make some modifications to your apps.

Among other changes, the 22.4 release removes the Axios dependency from all core `@sitecore-jss` packages. The dependency was deeply ingrained in core JSS functionality, and its removal provides greater flexibility in how your JSS app can communicate with Sitecore, be that via native node fetch, some alternative fetch library, or one of the latest versions of Axios including current security fixes and features.

> [!note]
> For a full summary of the changes relating to removal of Axios as the default fetcher, refer to the related [changelog entry](https://developers.sitecore.com/changelog/xm-cloud/23012025/removal-of-axios-as-default-fetcher-for-jss).

> [!note]
> **Before you begin**
> -   If you haven't already done so, [upgrade your app to JSS 22.3](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-3.html "Upgrade JSS apps to JSS 22.3").
>
> -   Familiarize yourself with the [JSS 22.4 release notes](https://github.com/Sitecore/jss/releases/tag/v22.4.0) to ensure you understand the implications of upgrading.

This topic describes how to:

:::walkthrough
1. [Update Angular apps](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-4.html#update-angular-apps)
2. [Update React apps](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-4.html#update-react-apps)
3. [Update Vue.js apps](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-4.html#update-vuejs-apps)
4. [Update application dependencies](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-4.html#update-application-dependencies)
:::

> [!note]
> To update your JSS Next.js applications, follow the [detailed upgrade guide from JSS 22.3 to 22.4 for JSS Next.js apps](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-22-3-next-js-apps-to-version-22-4.html "Upgrade JSS 22.3 Next.js apps to version 22.4") instead of this topic.

## Update Angular apps

To update your Angular applications:

1. Replace all Axios import statements, where present, as follows:

    | Existing import | Replacement import |
    | --- | --- |
    | `AxiosDataFetcher` | `NativeDataFetcher` |
    | `AxiosResponse` | `NativeDataFetcherResponse` |
    | `AxiosDataFetcherConfig` | `NativeDataFetcherConfig` |

2. [Update your application's JSS package, and install dependencies](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-4.html#UUID-b53911fa-c665-b896-f512-c384d02fa923_section-idm1853427912098058 "Update application dependencies").

## Update React apps

To update your React applications:

1. Throughout your application (except `src/dataFetcher.js`), replace all Axios import statements as follows:

    | Existing import | Replacement import |
    | --- | --- |
    | `AxiosDataFetcher` | `NativeDataFetcher` |
    | `AxiosResponse` | `NativeDataFetcherResponse` |
    | `AxiosDataFetcherConfig` | `NativeDataFetcherConfig` |

2. [Update your application's JSS package, and install dependencies](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-4.html#UUID-b53911fa-c665-b896-f512-c384d02fa923_section-idm1853427912098058 "Update application dependencies").

Additionally, if you want to switch your data fetch logic from Axios to the JSS native implementation (based on Node.js in-built logic), make the following changes:

1. In `server/server.js`, do the following:
    - Remove the Axios import statement:

        ```js
        import axios from 'axios';
        ```

    - Locate the following export statement:

        ```js
        export const setUpDefaultAgents = (httpAgent, httpsAgent) => {
          ...
        };
        ```

    - Delete the following lines from within that statement:

        ```js
        axios.defaults.httpAgent = httpAgent;
        axios.defaults.httpsAgent = httpsAgent;
        ```

2. In `src/dataFetcher.js`, do the following:
    - Locate the `AxiosFetcher` import statement.
    - Delete that statement and replace it with the following:

        ```js
        import { NativeDataFetcher } from '@sitecore-jss/sitecore-jss-react';
        ```

    - Locate the `dataFetcher` function.
    - Delete that function and replace it with the following:

        ```js
        export async function dataFetcher(url, data) {
          const fetcher = new NativeDataFetcher({ credentials: 'include' });
          const response = await fetcher.fetch(url, {
            method: data ? 'POST' : 'GET',
            headers: {
              'Content-Type': 'application/json',
            },
            body: data ? JSON.stringify(data) : undefined,
          });
          return response.data;
        }
        ```

3. In `package.json`, do the following:
    1. Delete the following dependency:

        ```js
        "axios": "^1.2.3",
        ```

    2. Apply the change with `npm install`.

## Update Vue.js apps

To update your Vue.js applications:

1. Throughout your application (except `src/dataFetcher.js`), replace all Axios import statements as follows:

    | Existing import | Replacement import |
    | --- | --- |
    | `AxiosDataFetcher` | `NativeDataFetcher` |
    | `AxiosResponse` | `NativeDataFetcherResponse` |
    | `AxiosDataFetcherConfig` | `NativeDataFetcherConfig` |

2. [Update your application's JSS package, and install dependencies](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-4.html#UUID-b53911fa-c665-b896-f512-c384d02fa923_section-idm1853427912098058 "Update application dependencies").

Additionally, if you want to switch your data fetch logic from Axios to the JSS native implementation (based on Node.js in-built logic), make the following changes:

1. In `server/server.js`, do the following:
    - Remove the Axios import statement:

        ```js
        import axios from 'axios';
        ```

    - Locate the following export statement:

        ```js
        export const setUpDefaultAgents = (httpAgent, httpsAgent) => {
          ...
        };
        ```

    - Delete the following lines from within that statement:

        ```js
        axios.defaults.httpAgent = httpAgent;
        axios.defaults.httpsAgent = httpsAgent;
        ```

2. In `src/dataFetcher.js`, do the following:
    - Locate the `Axios` import statement.
    - Delete that statement and replace it with the following:

        ```js
        import { NativeDataFetcher } from '@sitecore-jss/sitecore-jss-vue';
        ```

    - Locate the `dataFetcher` function.
    - Delete that function and replace it with the following:

        ```js
        export async function dataFetcher(url, data) {
          const fetcher = new NativeDataFetcher({ credentials: 'include' });
          const response = await fetcher.fetch(url, {
            method: data ? 'POST' : 'GET',
            headers: {
              'Content-Type': 'application/json',
            },
            body: data ? JSON.stringify(data) : undefined,
          });
          return response.data;
        }
        ```

3. In `package.json`, do the following:
    1. Delete the following dependency:

        ```js
        "axios": "^1.2.3",
        ```

    2. Apply the change with `npm install`.

## Update application dependencies

For your upgraded applications to work correctly, you must update dependencies.

To update your dependencies:

1. In your existing application's `package.json` file, update every `@sitecore-jss` package to version `~22.4`.
2. Install the dependencies with the following command:

    ```shell
    npm install
    ```