How to use Crayons in a React app

I managed to use the library adding at the beginning of the App component in a useEffect call, like this:

const scriptCrayons = document.createElement( "script" );
scriptCrayons.src =
     "https://unpkg.com/@freshworks/crayons/dist/crayons/crayons.js";
scriptCrayons.defer = true;
document.head.appendChild( scriptCrayons );

As was suggested by @velmurugan in another topic

6 Likes