Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to use data-sly-use in SPA React for content fragments?

Avatar

Level 4

Hi all,

We are working on custom SPA component which is supposed to take the given content fragment & use its field on page. 

In sites custom component we achieved this simply by using below snippet in html & it works fine. cfPath is content fragment path selected in component dialog's pathbrowser field.

<sly data-sly-test.cfPath="${'{0}/jcr:content/data/master' @ format=properties.cfPath}"
data-sly-use.cf="${cfPath}">
<p>${cf.fieldFromCF}</p>
<sly>

So, can anyone please help me to achieve the above in SPA react?

Any hint on this would be helpful.

Thanks,

sesmic

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

on spa there is not need of data sly use. Because front end is not Sightly there. 

On SPA you send all the props to react/angular side. And based on the props show hide logics are on angular/react.

Generally on spa we expose all the props to react or call a servlet for backend data

Avatar

Level 4

Hi @kaikubad,

Yes, I agree with you. But how can I implement it SPA?

In my SPA component how could I get the field values from CF.