How can I call a function that I loaded in my root head and want to call it in a route ? #9166
Unanswered
pullmann4rent
asked this question in
Q&A
Replies: 1 comment
-
try it this way: const [isClicked, setIsClicked] = useState(false);
useEffect(() => {
if (isClicked && typeof UC_UI !== 'undefined') {
UC_UI.showSecondLayer();
}
}, [isClicked]);
return (
<div>
<a href="#" onClick={() => setIsClicked(true)}>Privacy</a>
</div>
); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
in my root.tsx I loaded some external scripts.
All works good with the remix-utils libary.
But now I have to do add this link in a child route like /index
<a href="#" onClick="UC_UI.showSecondLayer();"> Privacy</a>
You see there is a function but when I call is this not works, I got error but when I use it like this {UC_UI.showSecondLayer();}
I get cannot find UC_UI....
So how can I run this function ? I loaded before a script in my head
Beta Was this translation helpful? Give feedback.
All reactions