SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
React.js for Rails
Developers
Marcin Grzywaczewski
Arkency
Problems
• You need to add dynamic elements to your Rails
application.
• You want to create Rails application in a single
page app fashion.
• You need to make an user experience as similar
as possible to their previous experience with
desktop apps.
Technical Problems
• To do it, you need some kind of JavaScript flavor
• Many Rails developers don’t like JavaScript
• Writing a good, maintainable client-side code is
hard (is it?)
Rails View Layer Tools
• Templates
• Views (ERB, Haml)
• View partials & helpers
• jQuery
• Turbolinks
Transitioning into dynamic
UI - stages
• No JavaScript
• jQuery explosion
• Page/Widget Objects
• Single Page Application
Page/Widget objects
• You create an abstraction over a logical piece of
your user interface
• You can unit test it, since it is a structured part of
the code
Question time
Hello, React.js!
• A library made by Facebook
• Only for user interface (V in MVC)
• Easy to learn
• Not only in the browser!
• Composability
Composability
• React.js operates on the concept of components
• You create components by composing smaller
components
• Ease of testing, ease of development
• Components are Page/Widget objects
Explaining React.js
Rails Views vs. React.js
• Templates
• Views (ERB, Haml)
• View partials
• jQuery
• Turbolinks
• ReactDOM.render
• JSX
• Components
• nothing
• setState
ReactDOM.render
• To render a React component, you use the
following call:



ReactDOM.render(what, where)
• what - a React component
• where - a real DOM node
• Equivalent of yield in Rails templates.
JSX
• React.js ships with a syntactic sugar to define
how the component looks like
• It is very similar to HTML and it allows JavaScript
injection (think ERB)
• For developers and designers convenience
React Components
• Defines a page/widget. Similar to Rails partial +
helpers attached
• Must have a render() method which renders the
JSX tree based on state and properties
• Properties - equivalent to locals in Rails partials
• State - a special piece of data which forces re-
render if changed
setState
• There can be a special piece of data called state in
every React component
• Calling setState updates the component - the render()
method is called with new state again
• Under the hood, React creates a minimal set of
changes needed to be done
• It is what makes React components dynamic!
• It's similar to Turbolinks
Integration with Rails
• react-rails (https://github.com/reactjs/react-rails)
• Browserify & Rails (http://blog.arkency.com/
2015/04/bring-commonjs-to-your-asset-pipeline/)
• custom integration with e.g. Webpack (what is
Webpack?: http://reactkungfu.com/2015/07/the-
hitchhikers-guide-to-modern-javascript-tooling/)
Question time
Bonus
• We have two books about React.js and six
books in total:
• React.js by Example - how to create cool
widgets you love and use using React.js
• Rails meets React.js - learning all needed
concepts of React.js with CoffeeScript and
Rails.
Use JETBRAINS_REACT_WEBINAR to get 35%
discount for all our books! Coupon valid to 1st of April.
http://bit.ly/buy-rails-meets-reactjs

http://bit.ly/buy-reactjs-by-example
Materials:
• Scaffold to React.js with full commit history: 

https://github.com/arkency/scaffold-to-react/commits/
newest-20160324
• React.js Koans - a set of exercises for beginners:
https://github.com/arkency/reactjs_koans (over 2500
stars on GitHub!)
• React Kung Fu blog: http://reactkungfu.com
• Showcase of examples you can find in React.js by
Example: https://reactkungfu.com/showcases/
Hey, ask us anything!
• Twitter: @Killavus @voter101 @andrzejkrzywda
@pankowecki
• Arkency Twitter: @arkency
• React Kung Fu Twitter: @reactkungfu
• Or mail: dev@arkency.com
Thank you!

Más contenido relacionado

La actualidad más candente

What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years agoAndres Almiray
 
Rails Engine :: modularize you app
Rails Engine :: modularize you appRails Engine :: modularize you app
Rails Engine :: modularize you appMuntasim Ahmed
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spinAndres Almiray
 
Rapid development with Rails
Rapid development with RailsRapid development with Rails
Rapid development with RailsYi-Ting Cheng
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfAlfresco Software
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworksKirk Madera
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular applicationmirrec
 
Isomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the webIsomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the webSigma Software
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Railsjduff
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraStoyan Zhekov
 
Angular Owin Katana TypeScript
Angular Owin Katana TypeScriptAngular Owin Katana TypeScript
Angular Owin Katana TypeScriptJustin Wendlandt
 
AEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly toolsAEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly toolsAshokkumar T A
 
Riding rails for 10 years
Riding rails for 10 yearsRiding rails for 10 years
Riding rails for 10 yearsjduff
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesEamonn Boyle
 
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014Enea Gabriel
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applicationsevilmike
 

La actualidad más candente (20)

What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years ago
 
Rails Engine :: modularize you app
Rails Engine :: modularize you appRails Engine :: modularize you app
Rails Engine :: modularize you app
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spin
 
Rapid development with Rails
Rapid development with RailsRapid development with Rails
Rapid development with Rails
 
SOA on Rails
SOA on RailsSOA on Rails
SOA on Rails
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
 
Isomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the webIsomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the web
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Rails
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
 
Angular Owin Katana TypeScript
Angular Owin Katana TypeScriptAngular Owin Katana TypeScript
Angular Owin Katana TypeScript
 
ASP.NET: Present and future
ASP.NET: Present and futureASP.NET: Present and future
ASP.NET: Present and future
 
AEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly toolsAEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly tools
 
Riding rails for 10 years
Riding rails for 10 yearsRiding rails for 10 years
Riding rails for 10 years
 
Avik_RailsTutorial
Avik_RailsTutorialAvik_RailsTutorial
Avik_RailsTutorial
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
 
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
The future of ASP.NET / CodeCamp/Iasi 25 Oct 2014
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applications
 

Destacado

#GetsmART Lessons from Artists #ipadpalooza16
#GetsmART Lessons from Artists #ipadpalooza16#GetsmART Lessons from Artists #ipadpalooza16
#GetsmART Lessons from Artists #ipadpalooza16Amy Burvall
 
An Agile Approach to Content Planning
An Agile Approach to Content PlanningAn Agile Approach to Content Planning
An Agile Approach to Content PlanningAJi
 
Franc, Oriol I Adria Relatos
Franc, Oriol I Adria RelatosFranc, Oriol I Adria Relatos
Franc, Oriol I Adria Relatos4esopalamos
 
Where Traditional Media is Headed
Where Traditional Media is HeadedWhere Traditional Media is Headed
Where Traditional Media is HeadedCharlie Ray
 
Nelson farias-acordes-arpejos-e-escalas
Nelson farias-acordes-arpejos-e-escalasNelson farias-acordes-arpejos-e-escalas
Nelson farias-acordes-arpejos-e-escalasNando Costa
 
PhRMA Report 2012: Medicines in Development for COPD
PhRMA Report 2012: Medicines in Development for COPDPhRMA Report 2012: Medicines in Development for COPD
PhRMA Report 2012: Medicines in Development for COPDPhRMA
 
SEMESTER 1: English Writing Brief - Essay Question (individual)
SEMESTER 1: English Writing Brief - Essay Question (individual)SEMESTER 1: English Writing Brief - Essay Question (individual)
SEMESTER 1: English Writing Brief - Essay Question (individual)University of Nottingham
 
Remarkable Retail
Remarkable RetailRemarkable Retail
Remarkable RetailTable19
 
how to make money blogging
how to make money blogginghow to make money blogging
how to make money bloggingBillieHillier
 
Effective ActiveRecord
Effective ActiveRecordEffective ActiveRecord
Effective ActiveRecordSmartLogic
 
Presentación sobre el curso de asignatura estatal
Presentación sobre el curso de asignatura estatalPresentación sobre el curso de asignatura estatal
Presentación sobre el curso de asignatura estatalKarina Serrano Jimenez
 
Lista de-precios-compugreiff-agosto-23-2012
Lista de-precios-compugreiff-agosto-23-2012Lista de-precios-compugreiff-agosto-23-2012
Lista de-precios-compugreiff-agosto-23-2012xxxxx
 
Why MAII Stratford University?
Why MAII Stratford University?Why MAII Stratford University?
Why MAII Stratford University?Prashant Pandey
 
Impacto de las TICs en mi vida
Impacto de las TICs en mi vidaImpacto de las TICs en mi vida
Impacto de las TICs en mi vidaMarinita93
 

Destacado (18)

Ejercicios 2
Ejercicios 2Ejercicios 2
Ejercicios 2
 
#GetsmART Lessons from Artists #ipadpalooza16
#GetsmART Lessons from Artists #ipadpalooza16#GetsmART Lessons from Artists #ipadpalooza16
#GetsmART Lessons from Artists #ipadpalooza16
 
www.clickprime8.com FALE COMIGO
www.clickprime8.com FALE COMIGO www.clickprime8.com FALE COMIGO
www.clickprime8.com FALE COMIGO
 
E learning technologies
E learning technologiesE learning technologies
E learning technologies
 
An Agile Approach to Content Planning
An Agile Approach to Content PlanningAn Agile Approach to Content Planning
An Agile Approach to Content Planning
 
Franc, Oriol I Adria Relatos
Franc, Oriol I Adria RelatosFranc, Oriol I Adria Relatos
Franc, Oriol I Adria Relatos
 
Where Traditional Media is Headed
Where Traditional Media is HeadedWhere Traditional Media is Headed
Where Traditional Media is Headed
 
Nelson farias-acordes-arpejos-e-escalas
Nelson farias-acordes-arpejos-e-escalasNelson farias-acordes-arpejos-e-escalas
Nelson farias-acordes-arpejos-e-escalas
 
PhRMA Report 2012: Medicines in Development for COPD
PhRMA Report 2012: Medicines in Development for COPDPhRMA Report 2012: Medicines in Development for COPD
PhRMA Report 2012: Medicines in Development for COPD
 
SEMESTER 1: English Writing Brief - Essay Question (individual)
SEMESTER 1: English Writing Brief - Essay Question (individual)SEMESTER 1: English Writing Brief - Essay Question (individual)
SEMESTER 1: English Writing Brief - Essay Question (individual)
 
Remarkable Retail
Remarkable RetailRemarkable Retail
Remarkable Retail
 
how to make money blogging
how to make money blogginghow to make money blogging
how to make money blogging
 
Effective ActiveRecord
Effective ActiveRecordEffective ActiveRecord
Effective ActiveRecord
 
Presentación sobre el curso de asignatura estatal
Presentación sobre el curso de asignatura estatalPresentación sobre el curso de asignatura estatal
Presentación sobre el curso de asignatura estatal
 
Lista de-precios-compugreiff-agosto-23-2012
Lista de-precios-compugreiff-agosto-23-2012Lista de-precios-compugreiff-agosto-23-2012
Lista de-precios-compugreiff-agosto-23-2012
 
Why MAII Stratford University?
Why MAII Stratford University?Why MAII Stratford University?
Why MAII Stratford University?
 
Mma col 2016 banano
Mma col 2016 bananoMma col 2016 banano
Mma col 2016 banano
 
Impacto de las TICs en mi vida
Impacto de las TICs en mi vidaImpacto de las TICs en mi vida
Impacto de las TICs en mi vida
 

Similar a React.js for Rails Developers

Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...MskDotNet Community
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theoryjobinThomas54
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementZach Lendon
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Zach Lendon
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and ReactMike Melusky
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React EcosystemFITC
 
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...SPTechCon
 
Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...Lucas Jellema
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React NativeMike Melusky
 
React js Online Training
React js Online TrainingReact js Online Training
React js Online TrainingLearntek1
 
React-Js-Online-Training-9028522.ppsx
React-Js-Online-Training-9028522.ppsxReact-Js-Online-Training-9028522.ppsx
React-Js-Online-Training-9028522.ppsxKulbir4
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with reduxMike Melusky
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Marco Breveglieri
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsJennifer Estrada
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Dimitri de Putte
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friendFilip Bruun Bech-Larsen
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativeRami Sayar
 

Similar a React.js for Rails Developers (20)

Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...Дмитрий Тежельников  «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
 
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 4: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 
Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...
 
React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React Native
 
React js Online Training
React js Online TrainingReact js Online Training
React js Online Training
 
React-Js-Online-Training-9028522.ppsx
React-Js-Online-Training-9028522.ppsxReact-Js-Online-Training-9028522.ppsx
React-Js-Online-Training-9028522.ppsx
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
 
Angular or React
Angular or ReactAngular or React
Angular or React
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 

Último

WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 

Último (20)

WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

React.js for Rails Developers

  • 1. React.js for Rails Developers Marcin Grzywaczewski Arkency
  • 2. Problems • You need to add dynamic elements to your Rails application. • You want to create Rails application in a single page app fashion. • You need to make an user experience as similar as possible to their previous experience with desktop apps.
  • 3. Technical Problems • To do it, you need some kind of JavaScript flavor • Many Rails developers don’t like JavaScript • Writing a good, maintainable client-side code is hard (is it?)
  • 4. Rails View Layer Tools • Templates • Views (ERB, Haml) • View partials & helpers • jQuery • Turbolinks
  • 5. Transitioning into dynamic UI - stages • No JavaScript • jQuery explosion • Page/Widget Objects • Single Page Application
  • 6. Page/Widget objects • You create an abstraction over a logical piece of your user interface • You can unit test it, since it is a structured part of the code
  • 8. Hello, React.js! • A library made by Facebook • Only for user interface (V in MVC) • Easy to learn • Not only in the browser! • Composability
  • 9. Composability • React.js operates on the concept of components • You create components by composing smaller components • Ease of testing, ease of development • Components are Page/Widget objects
  • 11. Rails Views vs. React.js • Templates • Views (ERB, Haml) • View partials • jQuery • Turbolinks • ReactDOM.render • JSX • Components • nothing • setState
  • 12. ReactDOM.render • To render a React component, you use the following call:
 
 ReactDOM.render(what, where) • what - a React component • where - a real DOM node • Equivalent of yield in Rails templates.
  • 13.
  • 14.
  • 15. JSX • React.js ships with a syntactic sugar to define how the component looks like • It is very similar to HTML and it allows JavaScript injection (think ERB) • For developers and designers convenience
  • 16.
  • 17.
  • 18. React Components • Defines a page/widget. Similar to Rails partial + helpers attached • Must have a render() method which renders the JSX tree based on state and properties • Properties - equivalent to locals in Rails partials • State - a special piece of data which forces re- render if changed
  • 19.
  • 20.
  • 21.
  • 22. setState • There can be a special piece of data called state in every React component • Calling setState updates the component - the render() method is called with new state again • Under the hood, React creates a minimal set of changes needed to be done • It is what makes React components dynamic! • It's similar to Turbolinks
  • 23.
  • 24.
  • 25. Integration with Rails • react-rails (https://github.com/reactjs/react-rails) • Browserify & Rails (http://blog.arkency.com/ 2015/04/bring-commonjs-to-your-asset-pipeline/) • custom integration with e.g. Webpack (what is Webpack?: http://reactkungfu.com/2015/07/the- hitchhikers-guide-to-modern-javascript-tooling/)
  • 27. Bonus • We have two books about React.js and six books in total: • React.js by Example - how to create cool widgets you love and use using React.js • Rails meets React.js - learning all needed concepts of React.js with CoffeeScript and Rails. Use JETBRAINS_REACT_WEBINAR to get 35% discount for all our books! Coupon valid to 1st of April.
  • 29. Materials: • Scaffold to React.js with full commit history: 
 https://github.com/arkency/scaffold-to-react/commits/ newest-20160324 • React.js Koans - a set of exercises for beginners: https://github.com/arkency/reactjs_koans (over 2500 stars on GitHub!) • React Kung Fu blog: http://reactkungfu.com • Showcase of examples you can find in React.js by Example: https://reactkungfu.com/showcases/
  • 30. Hey, ask us anything! • Twitter: @Killavus @voter101 @andrzejkrzywda @pankowecki • Arkency Twitter: @arkency • React Kung Fu Twitter: @reactkungfu • Or mail: dev@arkency.com