Make custom link

Hi,
I am trying to create custom port using this link in reatc js.
https://gojs.net/latest/samples/dynamicPorts.html

I am not getting where to place this function. If you have any example this in reactjs. Please let me know. I am stuck here for multiple days and didn’t get any solution.

const CustomLink = () => {
go.Link.call(this);
};
go.Diagram.inherit(CustomLink, go.Link);

If you want to define a class in JavaScript that works even in old browsers, you cannot use arrow functions.

If you want to use the newer (but already plenty old) class syntax, do something like what you see in https://gojs.net/latest/extensionsJSM/BalloonLink.js. That’s actually compiled from TypeScript, https://gojs.net/latest/extensionsJSM/BalloonLink.ts, but you don’t have to use TypeScript if you don’t want to.