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

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

> [!note]
> **Before you begin**
> -   If you haven't already done so, [upgrade your app to JSS 22.1](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-1.html "Upgrade JSS apps to JSS 22.1").
>
> -   Upgrade Node to version 22 or later.
>
> -   Familiarize yourself with the [JSS 22.3 release notes](https://github.com/Sitecore/jss/releases/tag/v22.3.1) 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-3.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-3.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-3.html#update-vuejs-apps)
4. [Update the Node headless SSR Experience Edge app](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-3.html#update-the-node-headless-ssr-experience-edge-app)
5. [Update the Node headless SSR proxy app](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-3.html#update-the-node-headless-ssr-proxy-app)
6. [Update application dependencies](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/upgrade-jss-apps-to-jss-22-3.html#update-application-dependencies)
:::

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

## Update Angular apps

Upgrading an Angular app to JSS 22.3 requires you to make multiple changes. Steps 1-6 of this process can be summarized as follows:

- Updating the `JssContextService` and all references to it, because some of the `sitecore-jss-angular` components now rely on the application state.
- Updating the initialization of i18n to improve performance while fetching Dictionary Data for SSR.

To update your Angular applications:

1. In `src/app/jss-context.service.ts`, do the following:
    - Locate the following import statement:

        ```ts
        import { LayoutServiceData } from '@sitecore-jss/sitecore-jss-angular';
        ```

    - Replace that statement with the following:

        ```ts
        import { LayoutServiceData, JssStateService } from '@sitecore-jss/sitecore-jss-angular';
        ```

    - Delete the `BehaviorSubject` import.
    - Delete the following field:

        ```ts
        state: BehaviorSubject<JssState>;
        ```

    - Add the following get statements and replace the constructor as shown:

        ```ts
        get state() {
          return this.stateService.state;
        }
        get stateValue() {
          return this.stateService.getStateValue();
        }
        constructor(protected transferState: TransferState, protected layoutService: JssLayoutService, protected stateService: JssStateService<JssState>) {
        }
        ```

    - Replace all instances of `this.state.next` with `this.stateService.setState`.
    - Replace all instances of `this.state.value` with `this.stateService.getStateValue()`.
2. In `src/app/jss-context.server-side.service.ts`, do the following:
    - Add the following import statement:

        ```ts
        import { JssStateService } from '@sitecore-jss/sitecore-jss-angular';
        ```

    - Delete the `JssDataFetcherService` import.
    - Modify the constructor to pass `JssStateService` and propagate it to the base class. For example:

        ```ts
        constructor(
          protected transferState: TransferState,
          protected layoutService: JssLayoutService,
          protected stateService: JssStateService<JssState>,
          // this initial state from sitecore is injected by server.bundle for "integrated" mode
          @Inject('JSS_SERVER_LAYOUT_DATA') private serverToSsrState: JssState
        ) {
          super(transferState, layoutService, stateService);
        }
        ```

3. In `app.module.ts`, remove the `HttpClient` import statement.

    Here's an example of the updated file suitable for JSS 22.3:

    ```ts
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (transferState: TransferState) =>
          new JssTranslationClientLoaderService(new JssTranslationLoaderService(), transferState),
        deps: [TransferState],
      },
    }),
    ```

4. In `app.server.module.ts`, import `TransferState`.

    Here's an example of the updated file suitable for JSS 22.3:

    ```csharp
    import { NgModule, TransferState } from "@angular/core";

    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (
          ssrViewBag: {
            [key: string]: unknown;
            dictionary: { [key: string]: string };
          },
          transferState: TransferState
        ) => new JssTranslationServerLoaderService(ssrViewBag, transferState),
        deps: ['JSS_SERVER_VIEWBAG', TransferState],
      },
    }),
    ```

5. In `app/i18n/jss-translation-server-loader.service.ts`, do the following:
    - Inject `TransferState`.
    - Make sure `dictionary` data is set in `transferState`.

    Here's an example of the updated file suitable for JSS 22.3:

    ```ts
    import {
      Inject,
      Injectable,
      makeStateKey,
      StateKey,
      TransferState,
    } from "@angular/core";
    import { DictionaryPhrases } from "@sitecore-jss/sitecore-jss-angular";
    ...

    export const dictionaryStateKey: StateKey<DictionaryPhrases> = makeStateKey<DictionaryPhrases>(
      'dictionary'
    );

    export class JssTranslationServerLoaderService implements TranslateLoader {
      constructor(
        @Inject('JSS_SERVER_VIEWBAG')
        private serverViewBag: { [key: string]: unknown; dictionary: DictionaryPhrases },
        private transferState: TransferState
      ) {}

      getTranslation(_lang: string) {
        const dictionary = this.serverViewBag.dictionary;

        this.transferState.set(dictionaryStateKey, dictionary);
        ...
      }
    }
    ```

6. In `app/i18n/jss-translation-client-loader.service.ts`, do the following:
    - Inject `TransferState`.
    - Check for dictionary data in `transferState` and use it if available and provided by the server.

    Here's an example of the updated file suitable for JSS 22.3:

    ```ts
    import { dictionaryStateKey } from './jss-translation-server-loader.service';
    import { Injectable, TransferState } from '@angular/core';
    import { TranslateLoader } from '@ngx-translate/core';
    import { DictionaryPhrases } from '@sitecore-jss/sitecore-jss-angular';
    import { EMPTY, Observable, of } from 'rxjs';
    import { JssTranslationLoaderService } from './jss-translation-loader.service';
    import { dictionaryStateKey } from './jss-translation-server-loader.service';

    @Injectable()
    export class JssTranslationClientLoaderService implements TranslateLoader {
      constructor(
        private fallbackLoader: JssTranslationLoaderService,
        private transferState: TransferState
      ) {}

      getTranslation(lang: string): Observable<DictionaryPhrases> {
        const dictionary = this.transferState.get(dictionaryStateKey, null);

        if (dictionary) {
          return of(dictionary);
        }
        ...
      }
    }
    ```

7. In the root `.gitignore` file, add a rule for `.angular` if you haven't already done so.
8. Replace the contents of `src/environments/.gitignore` with the following if you haven't already done so:

    ```

    *
    !.gitignore
    ```

9. In `package.json`, update the following `devDependencies`:

    ```json
    "@types/node": "~22.9.0",
    "@typescript-eslint/eslint-plugin": "^8.14.0",
    "@typescript-eslint/parser": "^8.14.0",
    ...
    "typescript": "~5.4.0",
    ```

10. In `src/tsconfig.app.json`, remove the following from `compilerOptions`:

    ```json
    "types": []
    ```

11. Repeat step 10 for `src/tsconfig.server.json`.
12. In `tsconfig.json`, add `"types": ["node"]` above `typeRoots`, such as:

    ```json
    ...
    "types": ["node"],
    "typeRoots": ["node_modules/@types"],
    ...
    ```

13. If you want to break the `config` and `generate-component-factory` into the new plugins architecture, do the following:
    - Copy the plugin files from the [Angular template](https://github.com/Sitecore/jss/tree/release/22.0.0/packages/create-sitecore-jss/src/templates/angular/scripts) to your app's `/scripts/config` and `/scripts/generate-component-factory` directories.
    - Import `./scripts/config` and `./generate-component-factory` in the `scripts/bootstrap.ts` file.
    - Copy the `scripts/generate-plugins.ts` file from the Angular template and import it in the `bootstrap.ts` file.

    Here's an example of the updated `bootstrap.ts` file suitable for JSS 22.3:

    ```js
    /*
       PLUGINS GENERATION
    */
    require("./generate-plugins");

    /*
      CONFIG GENERATION
    */
    require("./generate-config");

    /*
      COMPONENT FACTORY GENERATION
    */
    require("./generate-component-factory");
    ```

14. [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-3.html#UUID-2daec21d-9787-016f-6d10-cab67c5ef7c5_section-idm1853427912098058 "Update application dependencies").

## Update React apps

To update your React applications:

- In `.eslintrc`, set the `ecmaVersion` to `13`, as shown in the following example:

    ```json
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 13,
    "babelOptions": {
      "presets": ["@babel/preset-react"]
    }
    ```

## Update Vue.js apps

To update your Vue.js applications:

1. In `package.json`, the following dependencies are no longer required and can be removed:
    - `@vue/server-renderer`
    - `@vue/compiler-sfc`
2. Update the following packages to the stated versions:

    Table 2. 

    | Package | New version |
    | --- | --- |
    | `vue` | `^3.5.12` |
    | `@vue/apollo-option` | `^4.0.0` |
    | `@vue/apollo-ssr` | `^4.0.0` |

3. [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-3.html#UUID-2daec21d-9787-016f-6d10-cab67c5ef7c5_section-idm1853427912098058 "Update application dependencies").

## Update the Node headless SSR Experience Edge app

To update your Node headless SSR Experience Edge app:

- Update the following packages to the stated versions:

    Table 3. 

    | Package | New version |
    | --- | --- |
    | `@types/node` | `^22.9.0` |
    | `typescript` | `~5.6.3` |

## Update the Node headless SSR proxy app

To update your Node headless SSR proxy app:

- Update the following packages to the stated versions:

    Table 4. 

    | Package | New version |
    | --- | --- |
    | `@types/node` | `^22.9.0` |
    | `typescript` | `~5.6.3` |

## 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.3`.
2. Install the dependencies with the following command:

    ```shell
    npm install
    ```