-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OY2-16868: Add Jira Issue Collector Feedback Tab to Dev Environment (#…
…891)
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useEffect } from 'react' | ||
|
||
// Add script to bottom of page, with handling for some generic boolean value to flag on or off | ||
const useScript = (url: string, featureFlag: boolean): void => { | ||
useEffect(() => { | ||
if (featureFlag) { | ||
const script = document.createElement('script') | ||
|
||
script.src = url | ||
script.async = true | ||
script.text = 'text/javascript' | ||
|
||
document.body.appendChild(script) | ||
|
||
return () => { | ||
document.body.removeChild(script) | ||
} | ||
} | ||
}, [url, featureFlag]) | ||
} | ||
|
||
export { useScript } |
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