Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM React SPA - Extra Divs - Decoration

satishak9342628
Level 1
Level 1

We are working on AEM-React SPA integration. We see a set of extra Divs (Decorator DIV wrapping component) in the rendered HTML in the stand alone react app (npm start) bloating up the html. Is there any way to remove them from bloating the html ? There are lots of examples on the internet, and forums

But not much is discussed about how to fix this in the AEM React SPA. Have tried the example in the links mentioned but they don't work. Can i get help on how to remove the decorator DIV wrapping component in the AEM React SPA ?

I am using AEM 6.4.6.

1 Accepted Solution
Jörg_Hoh
Correct answer by
Employee
Employee

When you mean "AEM React SPA": are you using the SPA Editor feature of AEM? There I would wonder if this happens.

Thus you likely have a standard component, which is using React to render. And in that case I wonder why the mentioned examples cannot are not working.

For AEM your component is not special in any way. Have you tried with a very rudimentary, non-React component? Does it work there?

Jörg

View solution in original post

3 Replies
Jörg_Hoh
Correct answer by
Employee
Employee

When you mean "AEM React SPA": are you using the SPA Editor feature of AEM? There I would wonder if this happens.

Thus you likely have a standard component, which is using React to render. And in that case I wonder why the mentioned examples cannot are not working.

For AEM your component is not special in any way. Have you tried with a very rudimentary, non-React component? Does it work there?

Jörg

View solution in original post

satishak9342628
Level 1
Level 1

Yes, I am using the SPA Editor feature of AEM with React components. Followed the WKND AEM react SPA tutorial and added a couple of custom react components. I see these extra DIV in the Preview and react app rendered pages' source as well.

Non-react components work as expected with the fixes mentioned in the links.

Jörg_Hoh
Employee
Employee

Hi,

When you are using the SPA editor, you should have a full SPA without AEM rendering any markup; instead you should just consume JSON from AEM.

Or do I misunderstand your approach?

regards,

Jörg