该如何反应?导入URL以与useEffect
反应。我做对了吗?
HTML
// <style type="text/css" media="screen, projection">
// @import url(https://s3.amazonaws.com/assets.freshdesk.com/widget/freshwidget.css);
// </style>
反应
useEffect(() => {
const script = document.createElement('script');
script.src = "https://s3.amazonaws.com/assets.freshdesk.com/widget/freshwidget.csss";
script.type = "text/css";
script.media = "screen, projection"
script.async = true;
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
}
}, []);