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
480
GitHubのコマンドパレット使ってますか?
yuki21
0
1.7k
キャッシュを利用してRailsアプリの処理を高速化する
yuki21
0
130
gRPCを完璧に理解する
yuki21
0
53
RSpec -基本の基-
yuki21
0
59
Committeeを導入してみた
yuki21
0
160
マイクロサービスとモノリスとKBR
yuki21
0
55
ActiveModelSerializersについて
yuki21
0
45
脆弱性について
yuki21
0
170
Other Decks in Programming
See All in Programming
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
150
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
210
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.7k
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
240
技術的負債解消で開発者の未来を開く- AIの力でコード刷新
kmd2kmd
0
140
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
970
AIエージェントで 変わるAndroid開発環境
takahirom
1
180
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.2k
act1-costs.pdf
sumedhbala
0
160
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
570
A2UI という光を覗いてみる
satohjohn
1
170
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
750
Discover your Explorer Soul
emna__ayadi
2
1.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
How to build a perfect <img>
jonoalderson
1
5.8k
Designing for humans not robots
tammielis
254
26k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
Designing Powerful Visuals for Engaging Learning
tmiket
1
440
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
320
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
880
What's in a price? How to price your products and services
michaelherold
247
13k
Utilizing Notion as your number one productivity tool
mfonobong
4
340
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
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