Last active
May 10, 2020 16:24
-
-
Save singh-shweta/80488e8fa4c823a3b43e7dddf9508c46 to your computer and use it in GitHub Desktop.
This is just a component for example which can be used in any react project . This link in the component logs the navigation through the worker
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'; | |
import { sendLog } from "../initiateWorker"; | |
/** | |
This is just a component for example which can be used in any react project . | |
This link in the component logs the navigation by passing the object to the worker using the sendLog exposed | |
*/ | |
const AnchorLinkWithLogging = () => { | |
return ( | |
<a | |
href="/" | |
onClick={(e) => { | |
e.preventDefault(); | |
if (sendLog) { | |
sendLog({ | |
type: "navigation", | |
href: "OtherUrl", | |
fromProduct: "Current Product Name", | |
user: "abcd@dummy.com", | |
}); | |
} | |
}} | |
> | |
Test Worker | |
</a> | |
); | |
}; | |
export default AnchorLinkWithLogging; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment