Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Next.js & ElectronでTodoアプリを作る
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
yuki21
October 02, 2020
Programming
740
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Next.js & ElectronでTodoアプリを作る
5分間社内LT資料
yuki21
October 02, 2020
More Decks by yuki21
See All by yuki21
労務ドメインを快適に開発する方法 / How to Comfortably Develop in the Labor Domain
yuki21
1
470
GitHubのコマンドパレット使ってますか?
yuki21
0
1.7k
キャッシュを利用してRailsアプリの処理を高速化する
yuki21
0
130
gRPCを完璧に理解する
yuki21
0
52
RSpec -基本の基-
yuki21
0
58
Committeeを導入してみた
yuki21
0
150
マイクロサービスとモノリスとKBR
yuki21
0
54
ActiveModelSerializersについて
yuki21
0
44
脆弱性について
yuki21
0
170
Other Decks in Programming
See All in Programming
Vite+ Unified Toolchain for the Web
naokihaba
0
320
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
650
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
790
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
150
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
5.4k
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.7k
さぁV100、メモリをお食べ・・・
nilpe
0
140
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
360
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
210
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
180
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
Featured
See All Featured
Making Projects Easy
brettharned
120
6.7k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Language of Interfaces
destraynor
162
27k
The Spectacular Lies of Maps
axbom
PRO
1
810
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
220
Crafting Experiences
bethany
1
180
Statistics for Hackers
jakevdp
799
230k
Accessibility Awareness
sabderemane
1
140
Unsuck your backbone
ammeep
672
58k
Faster Mobile Websites
deanohume
310
31k
Transcript
Next.js & ElectronでTodoアプリを作る Kobayashi Yuta
Electronとは HTML CSS JavaScript等のWeb技術を使⽤して、 クロスプラットフォームのデスクトップアプリを構築することができる オープンソースフレームワークです。
プロジェクトを作成・ビルド実⾏ $ npx create-next-app --example with-electron-typescript todo-app $ cd todo-app
$ npm run build $ npm run start yarnが⼊ってなかったら⼊れておきます $ npm install -g yarn buildで作成されるファイルをgitの管理外にするために.gitignoreに追加します。 # .gitignore main dist renderer/out renderer/.next
None
画⾯を追加する 通常のNext.jsで新しいページを作成するのと同じように、 /pages配下にtodo.tsxを作成し、/components/Layout.tsxに作成したtodoへのリンクを配置 します。 import Link from "next/link"; ... <Link
href="/todo"> <a>Todo</a> </Link>
実装の前に… 少しでも⾒た⽬をリッチに仕上げるためにmaterial-uiを⼊れます。 $ npm install @material-ui/core
Todoを実装する const [inputValue, setInputValue] = useState(""); const [todoList, setTodoList] =
useState<String[]>([]); const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { event.preventDefault(); setTodoList([...todoList, inputValue]); setInputValue(""); }; return ( <Layout title="Todo"> <h1>Todo</h1> <form className={classes.root} noValidate autoComplete="off" onSubmit={handleSubmit}> <TextField id="task" label="Task" onChange={(e) => { setInputValue(e.target.value); }} value={inputValue} /> </form> <List component="nav" aria-label="secondary mailbox folders"> {todoList.map((todo) => ( <ListItem> <ListItemText primary={todo} /> </ListItem> ))} </List> </Layout> );
実際に動かしてみる
配布可能な状態にビルドする $ npm run dist 実⾏するとdist配下にdmgファイル等が⽣成されます。
まとめ 社内プロダクトで採⽤しているNext.jsの知識だけでデスクトップアプリを簡単に作るこ とができた。 production環境だとnext/linkの遷移がちゃんと⾏えなかったので改めて確認したい。
ご静聴ありがとうございました 参考 Next.js + Electron がとても簡単になっていた | Zenn https://zenn.dev/erukiti/articles/933fc127f751aef45b4f