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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.4k
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
450
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
170
Agentic UI
manfredsteyer
PRO
0
130
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
880
JavaDoc 再入門
nagise
0
320
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
190
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
120
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2k
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
200
Claspは野良GASの夢をみるか
takter00
0
180
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
340
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
940
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
200
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
A designer walks into a library…
pauljervisheath
211
24k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Visualization
eitanlees
152
17k
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