react-on-rails
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-rc.1
@@ -7,2 +7,5 @@ # Change Log | ||
## [3.0.0-beta.1] | ||
##### Fixed | ||
- Fix Bootstrap Sass Append to Gemfile, missing new line. [#262](https://github.com/shakacode/react_on_rails/pull/262). | ||
##### Added | ||
@@ -25,3 +28,3 @@ - Added helper `redux_store` and associated JavaScript APIs that allow multiple React components to use the same store. Thus, you initialize the store, with props, separately from the components. | ||
##### Migration | ||
##### Migration Steps v2 to v3 | ||
- [spec/dummy/spec/rails_helper.rb](https://github.com/shakacode/react_on_rails/blob/master/spec%2Fdummy%2Fspec%2Frails_helper.rb#L36..38) for an example. Add this line to your `rails_helper.rb`: | ||
@@ -33,3 +36,3 @@ ```ruby | ||
``` | ||
- Change view helper calls to react_component to use the named param of `props`. | ||
- Change view helper calls to react_component to use the named param of `props`. See forum post [Using Regexp to update to ReactOnRails v3](http://forum.shakacode.com/t/using-regexp-to-update-to-reactonrails-v3/481). | ||
@@ -36,0 +39,0 @@ ## [2.3.0] - 2016-02-01 |
@@ -77,3 +77,3 @@ 'use strict'; | ||
/** | ||
* Get an Map containing all registered components. Useful for debugging. | ||
* Get a Map containing all registered components. Useful for debugging. | ||
* @returns Map where key is the component name and values are the | ||
@@ -80,0 +80,0 @@ * { name, component, generatorFunction} |
@@ -87,3 +87,3 @@ 'use strict'; | ||
/** | ||
* Get an Map containing all registered store generators. Useful for debugging. | ||
* Get a Map containing all registered store generators. Useful for debugging. | ||
* @returns Map where key is the component name and values are the store generators. | ||
@@ -96,3 +96,3 @@ */ | ||
/** | ||
* Get an Map containing all hydrated stores. Useful for debugging. | ||
* Get a Map containing all hydrated stores. Useful for debugging. | ||
* @returns Map where key is the component name and values are the hydrated stores. | ||
@@ -99,0 +99,0 @@ */ |
{ | ||
"name": "react-on-rails", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-rc.1", | ||
"description": "react-on-rails JavaScript for react_on_rails Ruby gem", | ||
@@ -5,0 +5,0 @@ "main": "node_package/lib/ReactOnRails.js", |
@@ -5,4 +5,7 @@ [](https://travis-ci.org/shakacode/react_on_rails) [](https://coveralls.io/github/shakacode/react_on_rails?branch=master) [](https://gemnasium.com/shakacode/react_on_rails) [](https://badge.fury.io/rb/react_on_rails) [](https://badge.fury.io/js/react-on-rails) | ||
* 2.3 has shipped on Monday, 2/1/2016. Please see the [Changelog](CHANGELOG.md) for details, and let us know if you see any issues! [Migration steps from 1.x](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#migration-steps-v1-to-v2). | ||
* There was a fatal error when using the lastest version of Redux for server rendering. See [Redux #1335](https://github.com/rackt/redux/issues/1335). See [diff 3.1.6...3.1.4](https://github.com/rackt/redux/commit/e2e14d26f09ca729ae0555442f50fcfc45bfb423#diff-1fdf421c05c1140f6d71444ea2b27638). Workaround for server rendering: Use Redux 3.1.7 or upgrade to React On Rails v2.3.0. [this commit](https://github.com/shakacode/react_on_rails/commit/59f1e68d3d233775e6abc63bff180ea59ac2d79e) on [PR #244](https://github.com/shakacode/react_on_rails/pull/244/). | ||
* 3.0.0.beta.1 has shipped on Monday, 2/8/2016. Please see the [Changelog](CHANGELOG.md) for details, and let us know if you see any issues! [Migration steps from 1.x](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#migration-steps-v1-to-v2). [Migration steps from 2.x](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#migration-steps-v2-to-v3). | ||
* 3.0.0 Highlights: | ||
1. Support for ensuring JavaScript is current when running tests. | ||
2. Support for multiple React components with one Redux store. So you can have a header React component and different body React components talking to the same Redux store! | ||
* There was a fatal error when using the lastest version of Redux for server rendering. See [Redux #1335](https://github.com/rackt/redux/issues/1335). See [diff 3.1.6...3.1.4](https://github.com/rackt/redux/commit/e2e14d26f09ca729ae0555442f50fcfc45bfb423#diff-1fdf421c05c1140f6d71444ea2b27638). Workaround for server rendering: Use Redux 3.1.7 or upgrade to React On Rails v2.3.0. [this commit](https://github.com/shakacode/react_on_rails/commit/59f1e68d3d233775e6abc63bff180ea59ac2d79e) on [PR #244](https://github.com/shakacode/react_on_rails/pull/244/). | ||
* 2.x Highlights: | ||
@@ -222,9 +225,9 @@ 1. Fixed a **critical** problem with TurboLinks. Be sure to see [turbolinks docs](docs/additional_reading/turbolinks.md) for more information on how to debug TurboLinks issues. | ||
#### react_component | ||
`react_component(component_name, props = {}, options = {})` | ||
`react_component(component_name, options = {})` | ||
+ **component_name:** Can be a React component, created using a ES6 class, or `React.createClass`, or a generator function that returns a React component. | ||
+ **props:** Ruby Hash which contains the properties to pass to the react object, or a JSON string. If you pass a string, we'll escape it for you. | ||
+ **options:** | ||
+ **props:** Ruby Hash which contains the properties to pass to the react object, or a JSON string. If you pass a string, we'll escape it for you. | ||
+ **prerender:** enable server-side rendering of component. Set to false when debugging! | ||
+ **router_redirect_callback:** Use this option if you want to provide a custom handler for redirects on server rendering. If you don't specify this, we'll simply change the rendered output to a script that sets window.location to the new route. Set this up exactly like a generator_function. Your function will will take one parameter, containing all the values that react-router gives on a redirect request, such as pathname, search, etc. | ||
+ **router_redirect_callback:** Use this option if you want to provide a custom handler for redirects on server rendering. If you don't specify this, we'll simply change the rendered output to a script that sets window.location to the new route. Set this up exactly like a generator_function. Your function will take one parameter, containing all the values that react-router gives on a redirect request, such as pathname, search, etc. | ||
+ **trace:** set to true to print additional debugging information in the browser. Defaults to true for development, off otherwise. | ||
@@ -235,2 +238,10 @@ + **replay_console:** Default is true. False will disable echoing server-rendering logs to the browser. While this can make troubleshooting server rendering difficult, so long as you have the default configuration of logging_on_server set to true, you'll still see the errors on the server. | ||
#### redux_store | ||
`redux_store(store_name, props = {})` | ||
+ **store_name:** A name for the store. You'll refer to this name in 2 places in your JavaScript: | ||
1. You'll call `ReactOnRails.registerStore({storeName})` in the same place that you register your components. | ||
2. In your component definition, you'll call `ReactOnRails.getStore('storeName')` to get the hydrated Redux store to attach to your components. | ||
+ **props:** ReactOnRails takes care of setting up the hydration of your store with props from the view. | ||
#### Generator Functions | ||
@@ -297,3 +308,3 @@ Why would you create a function that returns a React compnent? For example, you may want the ability to use the passed-in props to initialize a redux store or setup react-router. Or you may want to return different components depending on what's in the props. ReactOnRails will automatically detect a registered generator function. | ||
You will need to make function that can create the store you will be using for all components and register it via the `registerStore` method. Note, this is a **storeCreator**, meaning that it is a function that takes props and returns a store: | ||
You will need to make a function that can create the store you will be using for all components and register it via the `registerStore` method. Note, this is a **storeCreator**, meaning that it is a function that takes props and returns a store: | ||
@@ -374,3 +385,3 @@ ``` | ||
##### Ruby Linters | ||
Ruby linters are **disabled by default**, but can be enabled by passing the `--ruby-linters` flag when generating. These linters have been added to your Gemfile in addition to the the appropriate Rake tasks. | ||
Ruby linters are **disabled by default**, but can be enabled by passing the `--ruby-linters` flag when generating. These linters have been added to your Gemfile in addition to the appropriate Rake tasks. | ||
@@ -424,3 +435,3 @@ We really love using all the linters! Give them a try. | ||
- Remove the generated generated lines for react-rails in your application.js file. | ||
- Remove the generated lines for react-rails in your application.js file. | ||
@@ -457,3 +468,3 @@ ``` | ||
## Demos | ||
+ [www.reactrails.com](http://www.reactrails.com) with source at [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). | ||
+ [www.reactrails.com](http://www.reactrails.com) with the source at [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). | ||
+ [spec app](spec/dummy): Great simple examples used for our tests. | ||
@@ -460,0 +471,0 @@ ``` |
75916
492