Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Upgrade to React v0.13 #19

Closed
sollycatprint opened this issue Jun 10, 2016 · 0 comments
Closed

Upgrade to React v0.13 #19

sollycatprint opened this issue Jun 10, 2016 · 0 comments

Comments

@sollycatprint
Copy link

From @zetachang on April 12, 2015 9:31

React.js v0.13 is released last month (http://facebook.github.io/react/blog/2015/03/10/react-v0.13.html).
Some work need to be done in react.rb to catch up this release, there is zetachang/react.rb#17 which tracks all the changes introduced.

Depends on react-source

Previously , react-source gem v0.12.0 is only used as development dependency. Since the changes introduced will break in version under 0.13, so we will explicitly depends on react-source.

Also, you can now include the react source simply by adding a line as below without manually download or manage the source.

<%= javascript_include_tag 'react.js' %>

Toll-free bridge React::Component

We are introducing toll-free bridge React::Component.

Previously, the Ruby instance created through React.render(Foo) is actually not the component instance created by React.js framework. The Ruby instance is created during first mount and cached inside the actual component instance as a property.

Upgrading

All the DSL you got by include React::Component remains almost the same. Only difference is that previously the native ReactComponent will be passed as the first argument in the initializer of your class. But since the instance is actually the real ReactComponent instance. So simply refer to self in your initializer if you want to do stuff with it.

Other breaking changes

  • props are immutable now, so set_props & set_props! are deprecated, see official blog post for upgrading details.
  • set_state! are deprecated (since replaceState is deprecated , see original issue for more details)
  • dom_node is deprecated in favor of React.find_dom_node
  • React.find_dom_node return a plain DOM object rather than a Native

I will move all the details to wiki when this is actually done, and feel free to leave a comment if there is any concern or clarification needed. 😉

Copied from original issue: zetachang/react.rb#19

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants