Electron set fullscreen onclick

You can set the full screen when you create the windows object.

const {BrowserWindow} = require('electron');
let win = new BrowserWindow({width: 800, height: 600, fullscreen: true});

Check here what options you can add when you make a window Electron BrowserWindow

My bad, i forgot you want to make it full on click. In a function use this.

var electron = require('electron');
var window = electron.remote.getCurrentWindow();
window.setFullScreen(true);

Suppose you have a certain button that you want to click for FullScreen to be enabled. The function bellow does the functionality of changing the screen to full screen. All you have to do is call it on the button click.

 const handleFullScreen =()=>{
    remote.getCurrentWindow().setFullScreen(true)
}

Note that remote I'm using remote because this function is triggered in the Renderer that's where my button that maximise the screen is.