You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to use JSX with CoffeeScript. The caveat is that you will still need to include the docblock. Since CoffeeScript doesn't allow `/* */` style comments, we need to do something a little different. We also need to embed JSX inside backticks so CoffeeScript ignores the syntax it doesn't understand. Here's an example:
93
+
94
+
```coffee
95
+
###* @jsx React.DOM ###
96
+
97
+
Component=React.createClass
98
+
render:->
99
+
`<ExampleComponent videos={this.props.videos} />`
100
+
```
101
+
102
+
90
103
## Configuring
91
104
92
105
### Variants
@@ -106,5 +119,28 @@ end
106
119
```
107
120
108
121
### Add-ons
122
+
Beginning with React v0.5, there is another type of build. This build ships with some "add-ons" that might be useful - [take a look at the React documentation for details](http://facebook.github.io/react/docs/addons.html). In order to make these available, we've added another configuration (which defaults to `false`).
123
+
124
+
```ruby
125
+
MyApp::Application.configure do
126
+
config.react.addons =true
127
+
end
128
+
```
129
+
130
+
### Changing react.js and JSXTransformer.js versions
131
+
132
+
In some cases you may want to have your `react.js` and `JSXTransformer.js` files come from a different release than the one, that is specified in the `react-rails.gemspec`. To achieve that, you have to manually replace them in your app.
133
+
134
+
#### Instructions
135
+
136
+
Just put another version of `react.js` or `JSXTransformer.js` under `/vendor/assets/react` directory.
137
+
If you need different versions of `react.js` for production and development, then use a subdirectory named
138
+
after `config.react.variant`, e.g. you set `config.react.variant = :development` so for this environment
139
+
`react.js` is expected to be in `/vendor/assets/react/development`
140
+
141
+
#### Things to remember
142
+
143
+
If you replace `JSXTransformer.js` in production environment, you have to restart your rails instance,
144
+
because the jsx compiler context is cached.
109
145
110
-
Beginning with React v0.5, there is another type of build. This build ships with some "add-ons" that might be useful - [take a look at the React documentation for details](http://facebook.github.io/react/docs/getting-started.html)
146
+
Name of the `JSXTransformer.js` file *is case-sensitive*.
0 commit comments