DEV Community

Discussion on: Setting Electron + React with Typescript

Collapse
 
shadowtsw profile image
Timmy • Edited

Nice work, good job !!

I guess, there is a small typing mistake:
To render the content correctly, the passed element needs to be "root" instead of "app" ?

ReactDOM.render(, document.getElementById('app'));
-->
ReactDOM.render(, document.getElementById('root'));

And inside the webpack.config.js the module "path" is missing via require
-->
const path = require("path");

Or am I wrong ?

Collapse
 
franamorim profile image
Francisco Amorim

Yup, you are right! Will edit the post.

For any strange behaivor you can check the repo.

Thx!

Collapse
 
madalucard profile image
Martin Lapihuska • Edited

Great article that helped me set up my enviroment. But i see that you did not changed in article @shadowtsw 's notes.

I am not sure if it's by changes over time, but this part of code did not worked for me.

console.log(isDev);
  win.loadURL(
    isDev
      ? 'http://localhost:9000'
      : `file://${app.getAppPath()}/index.html`,
  );
Enter fullscreen mode Exit fullscreen mode

Instead of win.loadURL('index.html'); i used win.loadFile('index.html'); and it started working showing content in windows.

Thx.