Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
React Native Code Reuse: Architecture that Works
Aaron Greenwald
September 13, 2016
Programming
1
370
React Native Code Reuse: Architecture that Works
Talk from React Native Tel Aviv (RN_TLV) meetup on the Wix roof, 2016/09/13
Aaron Greenwald
September 13, 2016
Tweet
Share
More Decks by Aaron Greenwald
See All by Aaron Greenwald
aarongreenwald
0
160
aarongreenwald
0
61
aarongreenwald
3
460
Other Decks in Programming
See All in Programming
canon1ky
3
340
yumcyawiz
4
610
line_developers_tw
0
370
dulltz
0
410
nbkouhou
1
1k
kyoheig3
0
410
pdone
0
210
kazaman97
0
170
attsumi
1
350
akatsukinewgrad
0
130
kyonmm
2
2.1k
ajstarks
2
550
Featured
See All Featured
rmw
11
740
shpigford
368
42k
iamctodd
17
1.8k
imathis
478
150k
tenderlove
52
3.4k
caitiem20
308
17k
malarkey
192
8.5k
roundedbygravity
241
21k
jnunemaker
PRO
40
4.5k
shpigford
165
19k
swwweet
206
6.8k
eitanlees
111
9.9k
Transcript
Architecture that Works React Native Code Reuse Aaron Greenwald github.com/aarongreenwald
@aaronjgreenwald aarong@wix.com
01 / The Promise
“...that approach yielded around 85% reuse of app code” -
Facebook
“...that approach yielded around 85% reuse of app code” -
Facebook “Don’t repeat yourself. It’s not only repetitive, it’s redundant, and people have heard it before.” - Lemony Snicket
Is it true?
Yes!
(Mostly)
Android & iOS
Web Apps Android & iOS
Web Apps Other RN Projects Android & iOS
02 / Android & iOS
Platform-Specific Code Platform Module Conditional statements in code
Platform-Specific Code Filename Suffixes Separate files per platform
Composition > Inheritance
Platform-Specific Code Platform Module Conditional statements in code Filename Suffixes
Separate files per platform
Architecture Matters
Keep logic out of views
Presenters/Dispatchers Keep logic out of views
Presenters/Dispatchers Logic should be cross-platform Keep logic out of views
Presenters/Dispatchers Logic should be cross-platform Keep logic out of views
Small & modular views
03 / Web Apps
Architecture Matters
Reusable application logic
Compilation gets complicated Reusable application logic
Create a separate module Compilation gets complicated Reusable application logic
Create a separate module Compilation gets complicated Reusable application logic
npm link...
04 / Multiple Projects
Architecture Matters
Binaries
Dependency Hell Binaries
Is it worthwhile? Dependency Hell Binaries
Architecture Matters
#architecture_matters github.com/aarongreenwald @aaronjgreenwald aarong@wix.com