README.md in react-rails-2.3.0 vs README.md in react-rails-2.3.1

- old
+ new

@@ -4,10 +4,17 @@ [![Build Status](https://img.shields.io/travis/reactjs/react-rails/master.svg?style=flat-square)](https://travis-ci.org/reactjs/react-rails) [![Gemnasium](https://img.shields.io/gemnasium/reactjs/react-rails.svg?style=flat-square)](https://gemnasium.com/reactjs/react-rails) [![Code Climate](https://img.shields.io/codeclimate/github/reactjs/react-rails.svg?style=flat-square)](https://codeclimate.com/github/reactjs/react-rails) [![Test Coverage](https://img.shields.io/codeclimate/coverage/github/reactjs/react-rails.svg?style=flat-square)](https://codeclimate.com/github/reactjs/react-rails/coverage) +You are looking at the 2.3 stable branch. This branch is for maintaining the prebundled 15.6 ReactJS with Addons. Gem version 2.4.x onwards and master will no longer have React Addons. + +If you need to make changes for the prebundled react, see the migration docs here: +https://reactjs.org/blog/2016/11/16/react-v15.4.0.html +https://reactjs.org/blog/2017/04/07/react-v15.5.0.html +https://reactjs.org/blog/2017/06/13/react-v15.6.0.html + `react-rails` makes it easy to use [React](http://facebook.github.io/react/) and [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) in your Ruby on Rails (3.2+) application. Learn more: - React's [Getting Started guide](https://facebook.github.io/react/docs/getting-started.html) - Use React & JSX [with webpacker](#use-with-webpacker) or [with the asset pipeline](#use-with-asset-pipeline) - Rendering [components in views](#view-helper) or [in controller actions](#controller-actions) @@ -88,29 +95,29 @@ Then restart your development server. This will: -- add some `//= require`s to `application.js` +- add some `//= require`s to `application.js` - add a `components/` directory for React components - add `server_rendering.js` for [server-side rendering](#server-side-rendering) Now, you can create React components in `.jsx` files: ```js // app/assets/javascripts/components/post.jsx -window.Post = React.createClass({ +window.Post = createReactClass({ render: function() { return <h1>{this.props.title}</h1> } }) // or, equivalent: class Post extends React.Component { render() { - return <h1>{this.props.title}</h1> + return <h1>{this.props.title}</h1> } } ``` Then, you can render those [components in views](#view-helper): @@ -137,19 +144,10 @@ ### React.js versions `//= require react` brings `React` into your project. -To include `React.addons`, add this config: - -```ruby -# config/application.rb -MyApp::Application.configure do - config.react.addons = true # defaults to false -end -``` - By default, React's [development version] is provided to `Rails.env.development`. You can override the React build with a config: ```ruby # Here are the defaults: # config/environments/development.rb @@ -393,15 +391,15 @@ ``` would generate: ```js -var Post = React.createClass({ +var Post = createReactClass({ propTypes: { - title: React.PropTypes.string, - published: React.PropTypes.bool, - publishedBy: React.PropTypes.instanceOf(Person) + title: PropTypes.string, + published: PropTypes.bool, + publishedBy: PropTypes.instanceOf(Person) }, render: function() { return ( <div> @@ -409,11 +407,11 @@ <div>Published: {this.props.published}</div> <div>Published By: {this.props.publishedBy}</div> </div> ); } -}); +}; ``` The generator also accepts options: - `--es6`: use `class ComponentName extends React.Component` @@ -473,17 +471,19 @@ ``` ## Related Projects - [react\_on\_rails Gem](https://github.com/shakacode/react_on_rails): Integration of React with Rails utilizing Webpack, Babel, React, Redux, React-Router. -- [Ruby Hyperloop](http://ruby-hyperloop.io/): Use Ruby to build reactive user interfaces with React. +- [Ruby Hyperloop](http://ruby-hyperloop.org/): Use Ruby to build reactive user interfaces with React. - [react-rails-hot-loader](https://github.com/rmosolgo/react-rails-hot-loader) is a simple live-reloader for `react-rails`. - [react-rails-benchmark_renderer](https://github.com/pboling/react-rails-benchmark_renderer) adds performance instrumentation to server rendering. - [The Free React on Rails Course](https://learnetto.com/users/hrishio/courses/the-free-react-on-rails-5-course) A free video course which teaches the basics of React and how to get started using it in Rails with `react-rails`. ## Development - Run tests with `rake test` or `appraisal rake test` + - Integration tests run in Headless Chrome which is included in Chrome (59+ linux,OSX | 60+ Windows) + - ChromeDriver is included with `chromedriver-helper` gem so no need to manually install that 👍 - Update React assets with `rake react:update` - Update the UJS with `rake ujs:update` - Releases: - To release a new RubyGems version: - Increment the version in `lib/react/rails/version.rb`