SlideShare a Scribd company logo
“WRITE ONCE”
Multi-Client Code Sharing in ReactJS
IN THE BEGINNING…
Early 2014, choosing a client-side tech for new project
• jQuery + sweat?
• Backbone + handlebars + etc?
• Angular?
• Ember?
… how to choose … ?
THE INEXORABLE MARCH OF TECH
new, shiny
bleeding edge
mature & stable
graveyard
of debt
cliff of fail
WE TRIED REACT
~0.9
IS AWESOME
How do we get this paradigm going everywhere??
WHY SHARE CODE?
Constraints:
• time
• build
• research, choosing tools
• team
• cognitive overhead
Benefits:
• efficiency of time/team
• design & interaction consistency
across clients
THE JOURNEY
STEP 1: SEPARATING CONCERNS
Client-side Application [web & responsive]
├─┬─ UI component repo
│ ├─── interaction component #1
│ ├─── interaction component #2
│ └─── interaction component #3
├─┬─ our API library
│ ├─── HTTP API
│ └─── WSS API
└─── other dependencies
STEP 2: SHARE UI COMPONENTS
UI components
Client app Rails
[client][webpack]
STEP 2: SHARE UI COMPONENTS
UI components
Client app Rails
Gem
[server + client][webpack]
STEP 3: SHARE UI MORE
UI components
Client app Rails Native
[webview]
Gem
UI components
Desktop
STEP 4: SHARE UI EVEN MORE
Client app Rails Native
[webview]
Gem
UI components
Rails
Native
[react]
STEP 5: SHARE UI MORE BETTERER
Client app
Gem
DesktopiOS android
NATIVE COMPONENTS
MyComponent.ios.js
MyComponent.android.js
SHARING WEB + NATIVE
• Content apps, not rich interaction or device access:
• yes: facebook, instagram, gmail, meetup, linkedin, simple games
• no: snapchat, 1st-person shooters/runners
• JS object inline styles, not css
• Some context detection at the component level
WEB + NATIVE COMPONENTS
const el = Platform.OS === 'web'
? React.DOM.div
: React.View
...
render() {
return el({},'content')
}
UI components
Rails
Native
[react]
STEP 5: SHARE UI MORE BETTERER
Client app
Gem
DesktopiOS android
“LEARN A LOT, WRITE A LOT”
#codinglife

More Related Content

PPTX
React Native.pptx (2)
PPTX
Introduction to React Native
PPTX
PDF
Introduction to react native
PDF
Introduction to React Native & Rendering Charts / Graphs
PPTX
Introduction to Ionic framework
PDF
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
PDF
React js vs angularjs
React Native.pptx (2)
Introduction to React Native
Introduction to react native
Introduction to React Native & Rendering Charts / Graphs
Introduction to Ionic framework
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
React js vs angularjs

What's hot (20)

PDF
Intro To React Native
PPTX
React vs angular what to choose for your app
PDF
High Productivity Web Development Workflow
PDF
PDF
React vs Angular, who wins the competition?
PPTX
Creating books app with react native
PDF
Getting Started with React Native (and should I use it at all?)
PPTX
React Native
PDF
React Native for multi-platform mobile applications
PDF
Jquery react angular
PDF
An overview of devportal technologies and their (dis)advantages
PPTX
React Native for ReactJS Devs
PPTX
20170321 docker with Visual Studio 2017
PDF
PPTX
ng-conf NativeScript and Angular 2 Workshop
PPTX
How Node.js Will Change Your Team
PPTX
React Native
PPTX
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
PDF
Utilizing HTML5 APIs
PDF
Modern Web Applications Utilizing HTML5 APIs
Intro To React Native
React vs angular what to choose for your app
High Productivity Web Development Workflow
React vs Angular, who wins the competition?
Creating books app with react native
Getting Started with React Native (and should I use it at all?)
React Native
React Native for multi-platform mobile applications
Jquery react angular
An overview of devportal technologies and their (dis)advantages
React Native for ReactJS Devs
20170321 docker with Visual Studio 2017
ng-conf NativeScript and Angular 2 Workshop
How Node.js Will Change Your Team
React Native
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIs
Ad

Viewers also liked (6)

PDF
Building Real Time App
PDF
how-to-disappear-from-the-web
PDF
React on rails v6.1 at LA Ruby, November 2016
PDF
Ruby on Rails for beginners
KEY
Enterprise Architectures with Ruby (and Rails)
PDF
From Obvious to Ingenius: Incrementally Scaling Web Apps on PostgreSQL
Building Real Time App
how-to-disappear-from-the-web
React on rails v6.1 at LA Ruby, November 2016
Ruby on Rails for beginners
Enterprise Architectures with Ruby (and Rails)
From Obvious to Ingenius: Incrementally Scaling Web Apps on PostgreSQL
Ad

Similar to Writing Once: Multi-client code sharing in ReactJS (20)

PPTX
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
PPTX
Detail Guide - Hire Dedicated React Native Developers for your Project
PDF
DEV117 - Unleash the Power of the AppDev Pack and Node.js in Domino
PDF
Docker Birthday #3 Slides - Overview
PDF
Docker Birthday #3 - Intro to Docker Slides
PPTX
Vue Or React - Which One is the Best_.pptx
PDF
Forge - DevCon 2016: Implementing Rich Applications in the Browser
PDF
Docker for dev
PDF
React for Non Techies
PDF
React for non techies
PPTX
Web summit.pptx
PDF
React for non techies
PDF
Internship-Report-VitulChauhan-18132023-IT_CRUD-OPERATION.pdf
PPTX
Advantages and Disadvantages of React Native App Development
PPT
Js frameworks
PDF
Dockerizing An Angular Application Using Git, Jenkins & Docker! | DevOps Tuto...
PDF
4 Phases followed by the Android Application Development Company.pdf
PDF
Common blind spots on the journey to production vijay raghavan aravamudhan
PPTX
React native
PDF
Comparing AngularJS and ReactJS_ Finding the Best Framework for your Next Pro...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
Detail Guide - Hire Dedicated React Native Developers for your Project
DEV117 - Unleash the Power of the AppDev Pack and Node.js in Domino
Docker Birthday #3 Slides - Overview
Docker Birthday #3 - Intro to Docker Slides
Vue Or React - Which One is the Best_.pptx
Forge - DevCon 2016: Implementing Rich Applications in the Browser
Docker for dev
React for Non Techies
React for non techies
Web summit.pptx
React for non techies
Internship-Report-VitulChauhan-18132023-IT_CRUD-OPERATION.pdf
Advantages and Disadvantages of React Native App Development
Js frameworks
Dockerizing An Angular Application Using Git, Jenkins & Docker! | DevOps Tuto...
4 Phases followed by the Android Application Development Company.pdf
Common blind spots on the journey to production vijay raghavan aravamudhan
React native
Comparing AngularJS and ReactJS_ Finding the Best Framework for your Next Pro...

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
STKI Israel Market Study 2025 version august
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
project resource management chapter-09.pdf
PDF
Hybrid model detection and classification of lung cancer
PPTX
Modernising the Digital Integration Hub
PDF
Getting Started with Data Integration: FME Form 101
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Architecture types and enterprise applications.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
August Patch Tuesday
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
NewMind AI Weekly Chronicles – August ’25 Week III
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
STKI Israel Market Study 2025 version august
Getting started with AI Agents and Multi-Agent Systems
Programs and apps: productivity, graphics, security and other tools
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Enhancing emotion recognition model for a student engagement use case through...
project resource management chapter-09.pdf
Hybrid model detection and classification of lung cancer
Modernising the Digital Integration Hub
Getting Started with Data Integration: FME Form 101
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Chapter 5: Probability Theory and Statistics
Architecture types and enterprise applications.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Final SEM Unit 1 for mit wpu at pune .pptx
August Patch Tuesday
A contest of sentiment analysis: k-nearest neighbor versus neural network
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
DP Operators-handbook-extract for the Mautical Institute

Writing Once: Multi-client code sharing in ReactJS