-
Notifications
You must be signed in to change notification settings - Fork 28
React Component
React Component extension for at.js library exposes a React Component that acts as a container for offers delivered by at.js.
- The current version of the component is to be used only on the client-side.
- AT.js library
- React and React-dom libraries
- Include at.js;
- Install target-react-component:
npm install @adobe/target-react-component --save
; - In your React app, initialize the Target component like this:
import createTargetComponent from '@adobe/target-react-component';
let Target = createTargetComponent(React);
- Then include it in your app components' onRender() methods (data-mbox prop is mandatory):
onRender: function () {
return (
<div>(...)
<Target data-mbox="myMboxName">
Default content.
</Target>
(...)</div>
);
}
- The content enclosed by the Target component will be hidden initially, and later will be either made visible (in case of an issue with offer fetching/applying) or replaced with fetched Target offers (on successful offer retrieval).
The component can be configured by passing at.js options
at app runtime as new component props via the component's element attributes.
This way, new content can be fetched and applied once a parent component updates the Target component's props by passing it new or updated data attributes.
For more details, check out the extension README and see the demos in action.
These extensions are provided free to developers as a starting point to integrate at.js with their Single Page Application. Extensions are not always updated for the latest at.js version. Customization may be required to integrate successfully with your single page app.
Issues: place send feedback and questions through Github issues. We will respond as best we can. Please note, these extensions are not supported by Adobe Client Care or Target Engineering.