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
redux-towerでルーティングを制する
Search
Yuki Kodama
February 07, 2017
Technology
2.8k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
redux-towerでルーティングを制する
Yuki Kodama
February 07, 2017
More Decks by Yuki Kodama
See All by Yuki Kodama
エージェント開発におけるObservability
kuy
0
65
マイクロフロントエンドの現状確認
kuy
0
530
Reason
kuy
1
2.5k
Should I use redux-saga or not?
kuy
2
4.8k
redux-sagaで副作用をコントロールする
kuy
4
1.7k
Rails+webpackの落ち穂拾い
kuy
0
1.9k
なぜReduxを使うのか
kuy
25
12k
意地でもReduxを使う
kuy
1
610
Other Decks in Technology
See All in Technology
会計事務所と顧問先の契約関係をOIDC・OAuthで表現する
terara
0
480
ClaudeCodeでセキュリティ監視業務を半自動化_1年の運用でわかったAIに任せる設計の5つのポイント
kintotechdev
3
890
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
アクセスキーが漏れた日にやるべきこと- 無効化の先にある本当の対応
kazzpapa3
0
360
markdown-poster Introduction
kazamori
0
390
OpenID for Verifiable Credentials 実装から見えた相互運用性確保までの道のり(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
350
Claude Teamプランの コスト最適化を考える
rfdnxbro
0
800
AI駆動開発はどこまで来たのか? ファインディの最新実態調査で読み解く現在地 Devin Con Tokyo
akiratom
4
1.9k
VPCでもFloatingIPを使いたいんだ
y_kotani
1
120
「面白い!」を信じ抜け。激動の時代を貫く、オンリーワン・エンジニアの条件
kizawa2020
1
370
8bit CPU 2026
koba789
7
3k
AI時代のデータ基盤を考える問い
pacocat
0
740
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
390
Into the Great Unknown - MozCon
thekraken
41
2.7k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
970
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
300
Paper Plane
katiecoart
PRO
2
53k
We Are The Robots
honzajavorek
0
310
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
Building AI with AI
inesmontani
PRO
1
1.2k
Transcript
redux-tower でルーティングを制する @kuy / Yuki Kodama 2017.02.07 @ Meguro.es #8
自己紹介 @kuy (カイ) / Yuki Kodama 株式会社ジャパンベンチャーリサーチ(新橋 → 恵比寿) entrepedia(アントレペディア)の開発・運用
AWS, Ruby on Rails, JavaScript (React+Redux+Saga) • redux-sagaでルーティングを制する • redux-sagaで非同期処理と戦う • Reduxでコンポーネントを再利用する • ・・・など Qiita の記事
redux-tower というのは・・・ • redux-saga を使ったルーティングライブラリ • ルートがアクティブになってからコンポーネントを表示するまでのロジックを Saga で書く →
フルコントロール可能 ◦ データの読み込み、認証、フォーム内容が変更されていたらページ遷移をブ ロック、途中でリダイレクト、...etc • ルート定義は JSON(JSX は使わない) ◦ ネスト可能、Entering/Leavingフック、省略記法 • SSR は未対応(試してすらいない・・・) ◦ 自分が SSR やってないだけなので PR 歓迎! リポジトリ https://github.com/kuy/redux-tower
ルート定義 #1 ルート定義 ルートアクション (Saga) パス + =
ルート定義 #2 ReduxのStateからログイン状態を取得して、未ログインのときのみログイ ンページにリダイレクト
ルート定義 #3 ログイン処理の結果を待って、成功したときは管理ページ、失敗したときは ログインページにリダイレクト
仕組み #1 • redux-sagaとルートアクションの間に入るProxy Generator ◦ redux-tower 自体も redux-saga で動く
Saga の1つにすぎない • redux-saga ↔ redux-tower ↔ ルートアクション ◦ パスの変更を検出してルート定義とのマッチング ◦ ルートアクションもただのGeneratorなのでnext()呼び出してyieldされ た値を取り出す ◦ 省略記法のときだけSagaのEffectに変換したり、特別な処理 ◦ あとはredux-sagaに丸投げ
仕組み #2 通常のSagaのEffectだった場合(callとかtakeとか)
仕組み #3 React コンポーネントが yield された場合(省略記法)
今後 • セットアップの簡素化 • Leavingフックの改善 • スクロール位置の復元 • バグ直さないと・・・ •
明日、redux-towerを使った社内向けシステムの管理画面リリース • 1.0 リリース ◦ その前にまずは 0.1.0 リリース
ブログアプリのデモ http://kuy.github.io/redux-tower/blog/
yield call(say(“ Thank you !! ”));