Skip to main content

Introduction to Discover JS SDK for React


Introduction to integrating with Sitecore Discover using Discover JS SDK and UI components for React.

Using Sitecore DiscoverJS SDK and UI Components packages is the fastest way to integrate Discover experiences into your React applications. The two packages are exclusively created for React. You can install them in your project to access their contents. At compile time, the JS SDK is integrated into your React browser application.

At runtime, the JS SDK uses its built-in methods to access the Discover API. Every request returns configuration data for your implementation from the Customer Engagement Console (CEC). The following diagram shows how the JS SDK orchestrates authentication, data requests and results, page and widget display, and event tracking.

Requests traveling from component to Discover API and back.

On a lower level, your React application contains widget or UI components. They connect with Discover API endpoints by using the query hooks and the API adapter from the JS SDK.

From a typical Model View Controller (MVC) perspective of the React framework:

  • The Model is provided by data requested from Discover by the API.

  • The View is made of the React UI components representing a widget.

  • The Controller is implemented by the query hooks to coordinate communication and manage the state of UI components.