This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// v17 and below | |
import ReactDOM from 'react-dom'; | |
const container = document.getElementById('app'); | |
ReactDOM.render(<App />, container); | |
// v18 | |
import { createRoot } from 'react-dom/client'; | |
const container = document.getElementById('app'); | |
const root = createRoot(container); | |
root.render(<App />); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = () => {throw new Error('Oops!')}; | |
const b = () => a(); | |
const c = () => b(); | |
try { | |
try { | |
c(); | |
console.log('Child worked.'); | |
} catch (e) { | |
console.log("Error inside child", e?.message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = _default; | |
function _config() { | |
const data = require("./config"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm run pack | |
> electron-lessons@1.0.0 pack /Projects/thatisuday/electron-lessons | |
> electron-builder -mwl | |
• electron-builder version=22.9.1 os=20.1.0 | |
• loaded configuration file=/Projects/thatisuday/electron-lessons/electron-builder.json | |
• Specified application directory equals to project dir — superfluous or wrong configuration appDirectory=. | |
• writing effective config file=out/builder-effective-config.yaml | |
• packaging platform=darwin arch=x64 electron=11.1.1 appOutDir=out/mac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "electron-lessons", | |
"version": "1.0.0", | |
"description": "A sample Electron (JS) project for Medium lessons.", | |
"main": "app/index.js", | |
"scripts": { | |
"start": "electron .", | |
"postinstall": "electron-builder install-app-deps", | |
"pack": "electron-builder -nwl" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"appId": "com.thatisuday.fileio", | |
"productName": "Electron File IO", | |
"copyright": "THATISUDAY TECH PVT. LTD.", | |
"directories": { | |
"app": ".", | |
"output": "out", | |
"buildResources": "build-res" | |
}, | |
"files": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hello { | |
display: flex; | |
flex-direction: column; | |
justify-content: center; | |
align-items: center; | |
&__btn { | |
&--odd { | |
background-color: beige; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
// local dependencies | |
import { getVersion } from 'common/util'; | |
// import styles (for compilation) | |
import './styles.scss'; | |
// export a react component | |
export default ( props ) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
// import entry component | |
import Entry from './entry'; | |
// render `Entry` component | |
ReactDOM.render( | |
<Entry name='React'/>, | |
document.getElementById( 'app' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "electron-lessons", | |
"scripts": { | |
"start": "electron-webpack dev", | |
"build": "electron-webpack" | |
}, | |
"devDependencies": { | |
"electron": "^11.1.1", | |
"electron-webpack": "^2.8.2", | |
"webpack": "^4.44.2" |
NewerOlder