Last active
November 19, 2019 14:49
-
-
Save lucas-moraes/fef1cf5ff9cf51de0481a1bcff8c3159 to your computer and use it in GitHub Desktop.
HTML tag "script" for ReactJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const ScriptTag = (props) => { | |
React.useEffect(() => { | |
const script = document.createElement("script"); | |
script.async = true; | |
script.src = props.url; | |
document.body.appendChild(script); | |
}, []) | |
return( | |
<script url={props.url} /> | |
) | |
} | |
export default ScriptTag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment