AEM with react | Community
Skip to main content
Level 4
October 15, 2020
Solved

AEM with react

  • October 15, 2020
  • 1 reply
  • 1364 views

Hi all,

 

In my project, we are using AEM 6.4 with react. From aem we are exposing data to react as data props like below

<div data-component='changeAssessmentDetails' data-props='
{
"changeAssessmentTitle":"Change your assessment",
"cancelButtonbgColor":"#e3e000"
}
'></div>

 

In react, they are creating component using component name(changeAssessmentDetails) what we have exposed.

Now I got a requirement to show different UI for same component. I can send one field from aem as a data property. 

Based on that property ,Is it possible to show different UI in react?

Note: Data component name should be same in both the cases.

Thanks in advance. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Umesh_Thakur

If different UI means only look and feel then you can easily do it as just css class needs to be added. only thing you need to do is, from the data property get the value and based on the value you need to add css class for different UI.

 

1 reply

Umesh_Thakur
Community Advisor
Umesh_ThakurCommunity AdvisorAccepted solution
Community Advisor
October 15, 2020

If different UI means only look and feel then you can easily do it as just css class needs to be added. only thing you need to do is, from the data property get the value and based on the value you need to add css class for different UI.

 

Sandeep6Author
Level 4
October 15, 2020

Hi @umesh_thakur ,

 

Please provide me any example for the same.