score:0

either you add it in the index.html at public folder, assuming that you are using create-react-app

or you can add it programmatically, for instance:


function freshchat(props) {
    const body = useref();

    useeffect(() => {
        const fc_js = document.createelement('script');

        if (!window.fcsettings) {
            fc_js.type = 'text/javascript';
            fc_js.src = 'https://my-source-of-js.com/js/yourjs.js';
            if (body.current) {
                body.current.appendchild(fc_js);
            }
        }

        return () => {
            body.current = null;
        };
    }, [body]);

    return <div ref={body} classname="print:hidden" />;
}


Related Query

More Query from same tag