The Weather Component
The weather component is found in the top-left of the We.Retail Journal app. It displays the current weather of a defined location, pulling weather data dynamically.
Using the Weather Widget
When authoring content of the SPA in the SPA Editor, the weather component appears as any other AEM component, complete with a toolbar, and is editable.
The city can be updated in a dialog just like any other AEM component.
The change is persisted and the component updates itself automatically with new weather data.
Weather Component Implementation
The weather component is based on a publicly available React component, called React Open Weather. It has been adapted to work as a component within the We.Retail Journal sample SPA application.
The following are snippets of the NPM documentation of the usage of the React Open Weather component.
Reviewing the code of the customized weather component ( Weather.js) in the We.Retail Journal application:
-
Line 16: The React Open Weather widget is loaded as required.
-
Line 46: The
MapTofunction relates this React component to a corresponding AEM component so that it can be edited in the SPA Editor. -
Lines 22-29: The
EditConfigis defined, checking if the city has been populated and defining the value if empty. -
Lines 31-44: The Weather component extends the
Componentclass and provides the required data as defined in the NPM usage documentation for the React Open Weather component and renders the component.
Although a back-end component must already exist, the front-end developer can use the React Open Weather component in the We.Retail Journal SPA with little coding.
Next Step
For further information about developing SPAs for AEM see the article Developing SPAs for AEM.
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAdobe Experience Manager Roadmap Webinar, Part 1 (Sites & Assets) - Americas & EMEA
Preview the AEM Sites and Assets roadmap and agentic innovations. Ask the team live.
Adobe Experience Manager Roadmap Webinar, Part 1 (Sites & Assets) - Americas & APAC
Preview the AEM Sites and Assets roadmap and agentic innovations. Ask the team live.
Adobe Brand Visibility Roadmap Webinar - Americas & EMEA
Preview the Brand Visibility roadmap across Brand Concierge and AEM Sites. Ask live.