Expand my Community achievements bar.

SOLVED

Unable to initialize model manager api with remote spa app with newly created typescript react app

Avatar

Level 1

Hi Team,

 

We are trying to convert remote spa javascript implementation to typescript(vite app latest version) but we are facing issue to initiliaze model manager with type script aem remote spa implementation please suggest if any other way to initialize model manager api in typescript.

 

We have created a react typescript app with latest vite version and trying to integrate aem configuration in react app. Attached error screenshot.

 

Regards,

Lakshman.

 

 

Regards,

lakshman.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

Can you post your code? The only important part is that you should initiate the ModelManager before the root.render() invocation, or any other render() method which bootstrap the application. Like this:

...
import { ModelManager } from "@adobe/aem-spa-page-model-manager";

// Initialize the ModelManager before invoking root.render(..).
ModelManager.initializeAsync();

const container = document.getElementById('root');
const root = createRoot(container);
root.render(<App />);

Reference: https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-with-aem-headless/s...  



Esteban Bustamante

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi,

 

Can you post your code? The only important part is that you should initiate the ModelManager before the root.render() invocation, or any other render() method which bootstrap the application. Like this:

...
import { ModelManager } from "@adobe/aem-spa-page-model-manager";

// Initialize the ModelManager before invoking root.render(..).
ModelManager.initializeAsync();

const container = document.getElementById('root');
const root = createRoot(container);
root.render(<App />);

Reference: https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-with-aem-headless/s...  



Esteban Bustamante