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 - SPA (React) - Parameters in Routes

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Level 4

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. 

 

 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

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.