How to use electron's app.getPath() to store data?

Since the remote method is being considered deprecated, as shown here, I'd suggest you do this:

const {app} = require('electron');
console.log(app.getPath('userData'));

Here is what I use when I need to switch between dev and release

const electron = require('electron');
export const userDataPath = (electron.app || electron.remote.app).getPath(
  'userData'
);

Another way to prevent the error "getPath is not a function" is to make the code work both in the renderer process and the main process:

const electron = require('electron');

const configDir =  (electron.app || electron.remote.app).getPath('userData');
console.log(configDir);