SlideShare a Scribd company logo
React on Rails
Different ways of integrating. Pros and Cons
Different Ways of Integrating React into Rails - Pros and Cons
About me
• name’s Mikhail Bortnyk
About me
• name’s Mikhail Bortnyk

• team leader in Amoniac OU
About me
• name’s Mikhail Bortnyk

• team leader in Amoniac OU

• co-founder of kottans.org
About me
• name’s Mikhail Bortnyk

• team leader in Amoniac OU

• co-founder of kottans.org

• Ruby language researcher
About me
• name’s Mikhail Bortnyk

• team leader in Amoniac OU

• co-founder of kottans.org

• Ruby language researcher

• twitter: @mikhailbortnyk
About me
• name’s Mikhail Bortnyk

• team leader in Amoniac OU

• co-founder of kottans.org

• Ruby language researcher

• twitter: @mikhailbortnyk

• github: @vessi
Short history of SPA in Rails
Short history of SPA in Rails
• Started from UJS
Short history of SPA in Rails
• Started from UJS

• continued with Backbone.js (Marionette.js afterwards)
Short history of SPA in Rails
• Started from UJS

• continued with Backbone.js (Marionette.js afterwards)

• progressed to angular.js
Short history of SPA in Rails
• Started from UJS

• continued with Backbone.js (Marionette.js afterwards)

• progressed to angular.js

• appeared react.js support (3rd party gems)
Short history of SPA in Rails
• Started from UJS

• continued with Backbone.js (Marionette.js afterwards)

• progressed to angular.js

• appeared react.js support (3rd party gems)

• webpack becomes part of Rails via webpacker gem
DHH dislikes SPAs
DHH dislikes SPAs
https://www.reddit.com/r/ruby/comments/341dyk/
why_does_dhh_dislike_spas_so_much/
We are not DHH
and sometimes we need something more than Rails
How do we do frontend in Rails
from some hands-on experience
Case 1. Boring
(Standalone application)
Standalone frontend
• Pros and Cons
Standalone frontend
• Pros:

• full control on frontend development process
Standalone frontend
• Pros:

• full control on frontend development process

• use what you actually want
Standalone frontend
• Pros:

• full control on frontend development process

• use what you actually want

• no need to fight with assets pipeline
Standalone frontend
• Pros:

• full control on frontend development process

• use what you actually want

• no need to fight with assets pipeline

• SPA loads independently
Standalone frontend
• Cons:

• +1 AJAX request to load data
Standalone frontend
• Cons:

• +1 AJAX request to load data

• you need to coordinate build and deployment
Standalone frontend
• Cons:

• +1 AJAX request to load data

• you need to coordinate build and deployment

• dependencies hell management
Standalone frontend
• Cons:

• +1 AJAX request to load data

• you need to coordinate build and deployment

• dependencies hell management

• coordinate, coordinate, and coordinate again
Standalone frontend
• Cons:

• +1 AJAX request to load data

• you need to coordinate build and deployment

• dependencies hell management

• coordinate, coordinate, and coordinate again

• and don’t forget about API versioning!
Case 1.5. Creepy as hell
(In-Rails JS)
In-Rails JS
• Pros and Cons
In-Rails JS
• Pros:

• Almost nothing
In-Rails JS
• Pros:

• Almost nothing

• Deployed at the same time
In-Rails JS
• Cons:

• Hardly maintainable
In-Rails JS
• Cons:

• Hardly maintainable

• supports only in-browser JSX
In-Rails JS
• Cons:

• Hardly maintainable

• supports only in-browser JSX

• dependencies hell
In-Rails JS
• Cons:

• Hardly maintainable

• supports only in-browser JSX

• dependencies hell

• suits only for very simple SPAs
Case 2. Outdated
(react-rails gem)
react-rails gem
• Pros and Cons
react-rails gem
• Pros:

• fixed react.js version
react-rails gem
• Pros:

• fixed react.js version

• server-side rendering
react-rails gem
• Pros:

• fixed react.js version

• server-side rendering

• components generators
react-rails gem
• Pros:

• fixed react.js version

• server-side rendering

• components generators

• UJS integration
react-rails gem
• Pros:

• fixed react.js version

• server-side rendering

• components generators

• UJS integration

• turbolinks integration
react-rails gem
• Cons:

• fixed react.js version
react-rails gem
• Cons:

• fixed react.js version

• deep integration with assets pipeline
react-rails gem
• Cons:

• fixed react.js version

• deep integration with assets pipeline

• no source maps
react-rails gem
• Cons:

• fixed react.js version

• deep integration with assets pipeline

• no source maps

• forget about “all-in-component” behavior
Case 3. Current
(react_on_rails gem)
react_on_rails gem
• Pros and Cons
react_on_rails gem
• Pros:

• separate SPA folder
react_on_rails gem
• Pros:

• separate SPA folder

• a lot of helpers for react and redux
react_on_rails gem
• Pros:

• separate SPA folder

• a lot of helpers for react and redux

• templates for SPAs
react_on_rails gem
• Pros:

• separate SPA folder

• a lot of helpers for react and redux

• templates for SPAs

• webpack as an app builder
react_on_rails gem
• Pros:

• separate SPA folder

• a lot of helpers for react and redux

• templates for SPAs

• webpack as an app builder

• yarn as a package manager
react_on_rails gem
• Cons:

• separate SPA folder
react_on_rails gem
• Cons:

• separate SPA folder

• dirty dances to get HMR working
react_on_rails gem
• Cons:

• separate SPA folder

• dirty dances to get HMR working

• complicated documentation
react_on_rails gem
• Cons:

• separate SPA folder

• dirty dances to get HMR working

• complicated documentation

• need to wait for upgrade dependencies
react_on_rails gem
• Cons:

• separate SPA folder

• dirty dances to get HMR working

• complicated documentation

• need to wait for upgrade dependencies

• a lot of side-selling in documentation
Case 4. Probably future
(webpacker gem)
webpacker gem
• Pros and Cons
webpacker gem
• Pros:

• easily managed components (via packs)
webpacker gem
• Pros:

• easily managed components (via packs)

• works with Turbolinks
webpacker gem
• Pros:

• easily managed components (via packs)

• works with Turbolinks

• supports hot loading out of box
webpacker gem
• Pros:

• easily managed components (via packs)

• works with Turbolinks

• supports hot loading out of box

• integrated into Rails starting from 5.1
webpacker gem
• Pros:

• easily managed components (via packs)

• works with Turbolinks

• supports hot loading out of box

• integrated into Rails starting from 5.1

• package.json lives in the same folder
webpacker gem
• Pros:

• easily managed components (via packs)

• works with Turbolinks

• supports hot loading out of box

• integrated into Rails starting from 5.1

• package.json lives in the same folder

• config lives altogether with your app config
webpacker gem
• Cons:

• No server-side rendering
webpacker gem
• Cons:

• No server-side rendering

• SPA is highly integrated into Rails App source code
webpacker gem
• Cons:

• No server-side rendering

• SPA is highly integrated into Rails App source code

• Still needs some setup ceremonies
Different Ways of Integrating React into Rails - Pros and Cons
Showtime
Conclusions
Questions?
Thanks!

More Related Content

What's hot (20)

KEY
improving the performance of Rails web Applications
John McCaffrey
 
PDF
AWS Users Meetup April 2015
Jervin Real
 
PPTX
How NOT to get lost in the current JavaScript landscape
Radosław Scheibinger
 
KEY
Rapid development with Rails
Yi-Ting Cheng
 
PDF
Live Coverage at The New York Times
Scott Taylor
 
KEY
Torquebox rubyhoedown-2012
Lance Ball
 
PDF
Ruby Masters 2011
Fabio Akita
 
PDF
Taking Micronaut out for a spin
Andres Almiray
 
PDF
REST In Action: The Live Coverage Platform at the New York Times
Scott Taylor
 
PDF
What I wish I knew about maven years ago
Andres Almiray
 
PDF
WordPress: Getting Under the Hood
Scott Taylor
 
PDF
2015 WordCamp Maine Keynote
Scott Taylor
 
PDF
Deployment Nirvana
Adrian Pike
 
PDF
淺談 Startup 公司的軟體開發流程 v2
Wen-Tien Chang
 
PDF
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
daylerees
 
PPTX
They why behind php frameworks
Kirk Madera
 
PDF
Merging two big Symfony based applications - SymfonyCon 2017
Ivo Lukac
 
PPTX
Webservices: The RESTful Approach
Mushfekur Rahman
 
PDF
Web a Quebec - JS Debugging
Rami Sayar
 
PDF
Transactions and Concurrency Control Patterns - 2019
Vlad Mihalcea
 
improving the performance of Rails web Applications
John McCaffrey
 
AWS Users Meetup April 2015
Jervin Real
 
How NOT to get lost in the current JavaScript landscape
Radosław Scheibinger
 
Rapid development with Rails
Yi-Ting Cheng
 
Live Coverage at The New York Times
Scott Taylor
 
Torquebox rubyhoedown-2012
Lance Ball
 
Ruby Masters 2011
Fabio Akita
 
Taking Micronaut out for a spin
Andres Almiray
 
REST In Action: The Live Coverage Platform at the New York Times
Scott Taylor
 
What I wish I knew about maven years ago
Andres Almiray
 
WordPress: Getting Under the Hood
Scott Taylor
 
2015 WordCamp Maine Keynote
Scott Taylor
 
Deployment Nirvana
Adrian Pike
 
淺談 Startup 公司的軟體開發流程 v2
Wen-Tien Chang
 
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
daylerees
 
They why behind php frameworks
Kirk Madera
 
Merging two big Symfony based applications - SymfonyCon 2017
Ivo Lukac
 
Webservices: The RESTful Approach
Mushfekur Rahman
 
Web a Quebec - JS Debugging
Rami Sayar
 
Transactions and Concurrency Control Patterns - 2019
Vlad Mihalcea
 

Similar to Different Ways of Integrating React into Rails - Pros and Cons (20)

PDF
React on rails v6.1 at LA Ruby, November 2016
Justin Gordon
 
PDF
React on rails v4
Justin Gordon
 
PDF
React with Ruby on Rails: Perfect Pair to Build Web Apps
rorbitssoftware
 
PDF
React with rails a perfect combination to build modern web application
Katy Slemon
 
PDF
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
Katy Slemon
 
PDF
React.js for Rails Developers
Arkency
 
KEY
Wider than rails
Alexey Nayden
 
PDF
Rails api + JS app
knomedia
 
PDF
Things you must know on ruby on rails single page application
Andolasoft Inc
 
PDF
Agile Web Development With Rails 4th Edition 4th Edition Sam Ruby
waumapis
 
PDF
Why Would A Programmer Fall In Love With SPA?
Netguru
 
PDF
Rails 3 : Cool New Things
Y. Thong Kuah
 
PPTX
Progressive Enhancment with Rails and React
Tyler Johnston
 
PDF
Modern UI Development With Node.js
Ryan Anklam
 
PDF
Functional Web Apps with WebMachine Framework - Mikhail Bortnyk
Ruby Meditation
 
PDF
Functional Web Apps with WebMachine Framework
Amoniac OÜ
 
PPTX
Ruby conf
Shweta Kale
 
KEY
Ultra-modern Front-end Dev & Introducing Spar
Aaron White
 
PDF
What's new in ruby on rails 4
Silvio Relli
 
PDF
Front End Sadness to Happiness: The React on Rails Story
Justin Gordon
 
React on rails v6.1 at LA Ruby, November 2016
Justin Gordon
 
React on rails v4
Justin Gordon
 
React with Ruby on Rails: Perfect Pair to Build Web Apps
rorbitssoftware
 
React with rails a perfect combination to build modern web application
Katy Slemon
 
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
Katy Slemon
 
React.js for Rails Developers
Arkency
 
Wider than rails
Alexey Nayden
 
Rails api + JS app
knomedia
 
Things you must know on ruby on rails single page application
Andolasoft Inc
 
Agile Web Development With Rails 4th Edition 4th Edition Sam Ruby
waumapis
 
Why Would A Programmer Fall In Love With SPA?
Netguru
 
Rails 3 : Cool New Things
Y. Thong Kuah
 
Progressive Enhancment with Rails and React
Tyler Johnston
 
Modern UI Development With Node.js
Ryan Anklam
 
Functional Web Apps with WebMachine Framework - Mikhail Bortnyk
Ruby Meditation
 
Functional Web Apps with WebMachine Framework
Amoniac OÜ
 
Ruby conf
Shweta Kale
 
Ultra-modern Front-end Dev & Introducing Spar
Aaron White
 
What's new in ruby on rails 4
Silvio Relli
 
Front End Sadness to Happiness: The React on Rails Story
Justin Gordon
 
Ad

More from Amoniac OÜ (14)

PDF
Dokku your own heroku 21
Amoniac OÜ
 
PPTX
GO in Heterogeneous Language Environments
Amoniac OÜ
 
PDF
Cleaners of Caribbean
Amoniac OÜ
 
PPTX
Ruby JIT Compilation
Amoniac OÜ
 
PDF
Ambiguous Sinatra
Amoniac OÜ
 
PDF
Capistrano and SystemD
Amoniac OÜ
 
PPTX
Distributed Cluster in Ruby
Amoniac OÜ
 
PDF
Roda: Putting the Fun Back into Ruby Web Development
Amoniac OÜ
 
PDF
Rubymotion: Overview and Ecosystem
Amoniac OÜ
 
PDF
Rupher
Amoniac OÜ
 
PDF
Functional Ruby
Amoniac OÜ
 
PDF
How to Become a Сhef
Amoniac OÜ
 
PDF
Let's Count Bytes! Launching Ruby in 32K of RAM
Amoniac OÜ
 
PDF
Deployment tales
Amoniac OÜ
 
Dokku your own heroku 21
Amoniac OÜ
 
GO in Heterogeneous Language Environments
Amoniac OÜ
 
Cleaners of Caribbean
Amoniac OÜ
 
Ruby JIT Compilation
Amoniac OÜ
 
Ambiguous Sinatra
Amoniac OÜ
 
Capistrano and SystemD
Amoniac OÜ
 
Distributed Cluster in Ruby
Amoniac OÜ
 
Roda: Putting the Fun Back into Ruby Web Development
Amoniac OÜ
 
Rubymotion: Overview and Ecosystem
Amoniac OÜ
 
Rupher
Amoniac OÜ
 
Functional Ruby
Amoniac OÜ
 
How to Become a Сhef
Amoniac OÜ
 
Let's Count Bytes! Launching Ruby in 32K of RAM
Amoniac OÜ
 
Deployment tales
Amoniac OÜ
 
Ad

Recently uploaded (20)

PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Executive Business Intelligence Dashboards
vandeslie24
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 

Different Ways of Integrating React into Rails - Pros and Cons