Back to guides

Installation of the UserWay Widget in a React Application

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

  1. 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 your Account ID code.* (https://userway.org/code you can find your code here)

Step 2: Save Changes and Start React Application

  1. 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 require additional assistance, don’t hesitate to contact us at desk@support.userway.org.

Ready to Make Your Website Accessible?