react on rails
TRANSCRIPT
![Page 1: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/1.jpg)
Alicia Guerra
React on Rails
![Page 2: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/2.jpg)
Why Ruby?
Easy to learnObject-orientedRich LibrariesOpen source
![Page 3: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/3.jpg)
Intro to Ruby on Rails
Server-side web application framework written in Ruby.
Configure your code with database schema.
Uses metaprogramming techniques to write programs.
![Page 4: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/4.jpg)
Model-View-Controller in Ruby on Rails
A model maps to a table in a database and a Ruby file.
A controller is a server-side component that responds to external requests from the web server to the application.
A view is an erb file which is evaluated and converted to HTML at runtime.
![Page 5: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/5.jpg)
Why should we use React with Rails?
Rails views can only take you so far.Plain erb/haml views with jQuery for the first few
dynamic features aren’t enough.The code will become unmaintainable and hard to
understand.
![Page 6: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/6.jpg)
React.js
Leverages the virtual DOM for performance.Promotes componentized development. Just a view layer, so it helps make everything
more modular.Flux allows for unidirectional data flow.
![Page 7: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/7.jpg)
react-rails gem
Simplest way to start using React inside your Rails app.It uses the default rails asset management and
automatically transforms Rails into the asset pipeline using the Ruby Babel transpiler.
Code organization is done very much the Rails way.
![Page 8: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/8.jpg)
react_on_rails gem
Uses ES6 by default and state-of-the-art JavaScript tooling instead of relying on the Rails asset pipeline.
Doesn’t depend on jQuery.You can use npm to install JavaScript libraries.
![Page 9: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/9.jpg)
Rails API with a Separate FrontEnd React App
Separate the frontend and backend into 2 different apps.
The backend can be either a standard Rails app exposing some API endpoints with JSON output or it can be a Rails API-only app.
![Page 10: React on rails](https://reader035.vdocuments.mx/reader035/viewer/2022062400/58d0e11f1a28abba558b46e1/html5/thumbnails/10.jpg)
Contact Me
Alicia GuerraEmail: [email protected]: @skepchick92LinkedIn: linkedin.com/in/aliciaisabelguerra