/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/javascript/code-411-118-002/main.jsx
25 строк
704 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
import { useState } from 'react'; export default function App() { const [count, setCount] = useState(0); const [filePath, setFilePath] = useState(''); async function handleOpen() { const path = await window.desktop.openFile(); if (path) setFilePath(path); } return ( <main style={{ fontFamily: 'system-ui', padding: 24 }}> <h1>Electron + React</h1> <p>Счётчик: {count}</p> <button type="button" onClick={() => setCount((c) => c + 1)}> +1 </button> <button type="button" onClick={handleOpen} style={{ marginLeft: 8 }}> Открыть файл </button> {filePath && <p>Файл: {filePath}</p>} </main> ); }