AEM - SPA (React) - Parameters in Routes | Community
Skip to main content
Level 2
June 1, 2022
Solved

AEM - SPA (React) - Parameters in Routes

  • June 1, 2022
  • 1 reply
  • 842 views

Is there a way to pass a parameter in a route in AEM SPA?

 

I know the routes are dynamically generated from AEM pages but I would like to be able pass params to pre-populate components on the page via the url.

 

i.e. I have the following page> /content/site/en/authors

 

I want the author in the URL so if you visit the url you see the information for that author> /content/site/en/authors/#userHere

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 BipinCh1

Hi @gregy68980908 ,

 

Yes you can do this functionality with the spa react and pass the parameter. This parameter will not effect the rendering of the SPA react. 

For trying it out.

1. Get the AEM Spa Journal Project  https://github.com/adobe/aem-sample-we-retail-journal

2. Change the Navigation.js in react to add your '#userHere' in the getLink(). 

       Please Note, later you have to programmatically expose the props for each component to be added in the url of react component.

3. Build and redeploy clientlibs to the aem.

 

If you click on any link on the navigation the browser will display react spa with the parameter. 

 

 

 

1 reply

BipinCh1Accepted solution
Level 3
June 2, 2022

Hi @gregy68980908 ,

 

Yes you can do this functionality with the spa react and pass the parameter. This parameter will not effect the rendering of the SPA react. 

For trying it out.

1. Get the AEM Spa Journal Project  https://github.com/adobe/aem-sample-we-retail-journal

2. Change the Navigation.js in react to add your '#userHere' in the getLink(). 

       Please Note, later you have to programmatically expose the props for each component to be added in the url of react component.

3. Build and redeploy clientlibs to the aem.

 

If you click on any link on the navigation the browser will display react spa with the parameter.