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
Модульное React/Redux приложение
Search
Artem Bey
June 30, 2017
Programming
1
330
Модульное React/Redux приложение
Доклад о разделении крупного React/Redux приложения на модули с помощью redux-ducks и npm пакетов.
Artem Bey
June 30, 2017
Tweet
Share
More Decks by Artem Bey
See All by Artem Bey
Hypermedia API (MinskJS version)
defly
0
85
Node.js Streams
defly
0
170
Observable как атом приложения
defly
1
150
Other Decks in Programming
See All in Programming
Codex の「自走力」を高める
yorifuji
0
1.2k
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
150
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.8k
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8k
Unity6.3 AudioUpdate
cova8bitdots
0
130
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
240
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.7k
TipKitTips
ktcryomm
0
170
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
Fundamentals of Software Engineering In the Age of AI
therealdanvega
1
250
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
180
Windows on Ryzen and I
seosoft
0
280
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
450
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
Unsuck your backbone
ammeep
672
58k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
480
The Spectacular Lies of Maps
axbom
PRO
1
620
Scaling GitHub
holman
464
140k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Odyssey Design
rkendrick25
PRO
2
540
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
220
Transcript
Модульное React/Redux приложение
Артём Бей JavaScript Developer @defly_self 2
Модульное React/Redux приложение 3
4
Приложение из “реального мира” 5
В следующем спринте 6
Группировка по фичам 7
Single Page App store components webpack 8
разработчики биллинга команда главной фичи пилят админку Single Page App
store components webpack 9
Хотим деплоить! 10
зелёные что-то сломали … черт! мы подождем :( 11
- тесты - continuous integration - git flow 12
- тесты - continuous integration - git flow - git
revert - git cherry-pick 13
JavaScript Way package.json { "dependencies": { "@foocompany/admin": "2.3.1", "@foocompany/billing": "1.2.3",
"@foocompany/core": "4.1.7", "@foocompany/i18n": "0.4.2" "@foocompany/common.components": "0.3.1", … } } 14
"@foocompany/dashboard": "0.2.9" 15
redux-ducks - модульный Redux Модуль (пакет) экспортирует: - reducer -
action creators * - selectors * * если они нужны в других модулях action в виде: subapp/reducer/ACTION_TYPE 16
const LOADED = 'my-app/widgets/LOADED'; const CREATED = 'my-app/widgets/CREATED'; const UPDATED
= 'my-app/widgets/UPDATED'; const REMOVED = 'my-app/widgets/REMOVED'; export default function reducer(state = {}, action = {}) { switch (action.type) { // do reducer stuff default: return state; } } export function loadWidgets() { return { type: LOADED }; } export function createWidget(widget) { return { type: CREATED, widget }; } export function updateWidget(widget) { return { type: UPDATED, widget }; } export function removeWidget(widget) { return { type: REMOVED, widget }; } export function sayDuckAndWin(to = 'defly_self') { return { type: TWEETED, { to, text: ‘I <3 react', rule: 'be_first', hashtag: '#reactkyiv'} }; }
src/export.js package.json { "name": "@foocompany/module", "version": "0.7.2", "main": "src/export.js”, …
} 18 import { getRoutes } from './routes'; import { partialReducer } from './redux/reducer'; export { getRoutes, partialReducer };
- модули в npm - подключение меняется очень редко -
изоляция модуля в подприложение - все версии в package.json - легче написать release notes 19 В чем профит
Сложности - на каждый модуль свой репозиторий - npm link
не совсем удобен - необходимо следить за версиями - поддержка общих зависимостей - нарушения code style 20
Облегчаем себе жизнь - Monorepos - Автоматизация работы с версиями
- ESLint - Анализ зависимостей (webpack плагин) 21
Feature toggles 22
Почитать - The Ducks File Structure for Redux (Medium) -
Feature Toggles (Martin Fowler blog) - lernajs.io 23
Спасибо!