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.
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.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.
If you look to manually add the Script inside your <body>
, we have a tutorial here.