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
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
120
gRPCを完璧に理解する
yuki21
0
52
RSpec -基本の基-
yuki21
0
57
Committeeを導入してみた
yuki21
0
150
マイクロサービスとモノリスとKBR
yuki21
0
53
ActiveModelSerializersについて
yuki21
0
44
脆弱性について
yuki21
0
170
Other Decks in Programming
See All in Programming
dRuby over BLE
makicamel
2
330
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
160
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
270
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
450
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
350
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
New "Type" system on PicoRuby
pocke
1
820
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
2
560
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
160
スマートグラスで並列バイブコーディング
hyshu
0
120
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
110
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
120
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
How to Talk to Developers About Accessibility
jct
2
230
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
22k
Building Applications with DynamoDB
mza
96
7.1k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Deep Space Network (abreviated)
tonyrice
0
170
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
420
Embracing the Ebb and Flow
colly
88
5.1k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
330
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
BBQ
matthewcrist
89
10k
The World Runs on Bad Software
bkeepers
PRO
72
12k
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