react on rails

10
Alicia Guerra React on Rails

Upload: alicia-guerra

Post on 21-Mar-2017

28 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: React on rails

Alicia Guerra

React on Rails

Page 2: React on rails

Why Ruby?

Easy to learnObject-orientedRich LibrariesOpen source

Page 3: React on rails

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

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

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

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

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

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

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

Contact Me

Alicia GuerraEmail: [email protected]: @skepchick92LinkedIn: linkedin.com/in/aliciaisabelguerra