How to copy text to the clipboard in Electron

Copying text to the clipboard using Electron:

let text = 'Electron rocks!';


// Text is in the clipboard after this point

You can call this method from the App.js. That's it.

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.