Skip to content

Commit 8e58fdc

Browse files
committed
Updated docs with right information on changing react's version
1 parent d5c4717 commit 8e58fdc

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ As with all gem dependencies, we strongly recommend adding `react-rails` to your
2020
gem 'react-rails', '~> 0.8.0.0'
2121
```
2222

23+
Starting with `0.4.1` there is a fix, which alows execjs to transforms jsx files, so if you need a version lower than
24+
`0.4.1` you will have to replace JSXTransformer.js, see below on how to do it.
2325

2426
## Usage
2527

@@ -131,23 +133,20 @@ Component = React.createClass
131133

132134
### Changing react.js and JSXTransformer.js versions
133135

134-
Major, minor, and patch versions of this gem are based on react's version, e.g.
135-
`0.4.1.1` means that react has version `0.4.1`. There may be fixes or improvements
136-
introduced in say `0.5.0.0`, but you will still need react in version `0.4.1`.
137-
If you needed to change JSXTransformer version it's possible too.
136+
This gem's version is independent from actual react's version, that's why you need declarations for both `react-rails`
137+
and `react-source` in your `Gemfile`. However, in some cases you may want to have your `react.js` and `JSXTransformer.js`
138+
files come from different releases. To achieve that, you have to manually replace either of them in your app.
138139

139-
#### How to
140+
#### Instructions
140141

141-
Just put another version of react or JSXTransformer in your assets. Any place
142-
you would put a javascript file will be fine, probably
143-
`/vendor/javascripts/react.js` and `/vendor/javascripts/JSXTransformer.js`
144-
would be best. (You don't have to replace both)
142+
Just put another version of `react.js` or `JSXTransformer.js` under `/vendor/assets/react` directory.
143+
If you need different versions of `react.js` for production and development, then use a subdirectory named
144+
after `config.react.variant`, e.g. you set `config.react.variant = :development` so for this environment
145+
`react.js` is expected to be in `/vendor/assets/react/development`
145146

146147
#### Things to remember
147148

148149
If you replace `JSXTransformer.js`, you have to restart your rails instance,
149-
because the jsx compiler context is cached, name of the file is case-sensitive.
150+
because the jsx compiler context is cached.
150151

151-
We provide different variants of `react.js` based on environment, but you will
152-
need to provide the same file called `react.js` which will be used for both
153-
production and development.
152+
Name of the `JSXTransformer.js` file *is case-sensitive*.

0 commit comments

Comments
 (0)