Skip to content

Instantly share code, notes, and snippets.

@alielmajdaoui
Created November 4, 2022 21:44
Show Gist options
  • Save alielmajdaoui/022fe0379b4f74cedd1b66a7803afaee to your computer and use it in GitHub Desktop.
Save alielmajdaoui/022fe0379b4f74cedd1b66a7803afaee to your computer and use it in GitHub Desktop.
./src/renderer/App.tsx
import { useCallback } from 'react';
import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';
import icon from '../../assets/icon.svg';
import './App.css';
const Hello = () => {
const openSettingsWindow = useCallback(() => {
window.electron.ipcRenderer.openSettingsWindow();
}, []);
return (
<div>
<div className="Hello">
<img width="200" alt="icon" src={icon} />
</div>
<h1>electron-react-boilerplate</h1>
<div className="Hello">
<button type="button" onClick={openSettingsWindow}>
<span role="img" aria-label="gear">
⚙️
</span>
Open Settings
</button>
<a
href="https://electron-react-boilerplate.js.org/"
target="_blank"
rel="noreferrer"
>
<button type="button">
<span role="img" aria-label="books">
📚
</span>
Read our docs
</button>
</a>
<a
href="https://github.com/sponsors/electron-react-boilerplate"
target="_blank"
rel="noreferrer"
>
<button type="button">
<span role="img" aria-label="folded hands">
🙏
</span>
Donate
</button>
</a>
</div>
</div>
);
};
export default function App() {
return (
<Router>
<Routes>
<Route path="/" element={<Hello />} />
</Routes>
</Router>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment