Installation of UserWay in React Application
In this article, we will walk you through the installation process of UserWay in a React application.
To integrate UserWay into your React application, we will utilize the inline script addition method, which is suitable for short scripts that are specific to a particular component or page. We will explore the use of JSX components to achieve this.
Step 1: Add Code to Your Component
- Add this code directly within your component’s JSX code:
import React from ‘react’;
const UwScriptComponent = () => {
return (
<div> {/* JSX code */}
<script src=“https://cdn.userway.org/widget.js“ data-account=“YOUR_DATA_ACCOUNT“></script>
</div>
);
};export default UwScriptComponent;
Make sure to replace
YOUR_DATA_ACCOUNT
with yourAccount ID
code.
Step 2: Save Changes and Start React Application
- After adding the script, save the changes and start the React application:
# NPM START
Please ensure that your React component does not interfere with the final print or modify the data provided by the script.