Nicolas Medda, Mynewsdesk
Created by Facebook, open sourced in 2013.
React is just the UI and implements one-way reactive data flow
20k stars on github
node.js builtin system: npm
app.coffee
component.coffee
browserify -t coffeeify -t reactify module1.coffeeThat allow us to use components from others like this:
Same thing as the "lazy" render
but JS is executed on the backend and the React component markup is injected in the placeholder
When DOM is ready, React take control of the component
Gemfile
gem 'react-rails', '~> 1.0'config/application.rb
config.react.variant = :production
config.react.addons = true
config.react.max_renderers = 10
config.react.timeout = 20 # seconds
config.react.react_js = -> { "" }
config.react.component_filenames = ["components-server.js"]Integrate `browserify` in the assets pipeline
config/application.rb
config.browserify_rails.commandline_options =
"-t coffeeify -t [ reactify --everything ] -t pkgify --extension=\".coffee\""