Is there any documentation for creating nested AEM React SPA Component ? | Community
Skip to main content
Suraj_Kamdi
Community Advisor
Community Advisor
March 25, 2022

Is there any documentation for creating nested AEM React SPA Component ?

  • March 25, 2022
  • 1 reply
  • 1371 views

Is there any documentation for creating a nested AEM React SPA Component? For example, if you want to create a Component A which has Component B as a fixed component. I have a requirement where I want to render component B by Configuring component A.

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

1 reply

milind_bachani
Adobe Employee
Adobe Employee
March 25, 2022

Hi @suraj_kamdi ,

 

When you create SPA react component, you have to wrap the component B in render() of component A in the react code itself. You can refer react articles for component embedding and wrapping.

The only concept while embedding would be passing the required props to component B(fixed component) from component A(to be configured component).

 

One of the tutorials you can refer : https://www.pluralsight.com/guides/how-to-wrap-one-react-component-into-another

 

You need to import the componentB in componentA.

pseudo render():

//ComponentA render()

<div class="this-is-componentA-parent">
    //some html for component A here...
    <ComponentB expectedProp={props.propertyConfiguredInComponentA} />
</div>


Let me know if you still have any further concerns.
Thanks.

Suraj_Kamdi
Community Advisor
Community Advisor
March 29, 2022

This is not the solution. The component will not render in edit mode.

Suraj Kamdi
November 16, 2022

Did you find any solution? I'm facing the same scenario.