Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Info for migration guide to 2.1.0 #238

Closed
hisapy opened this issue Jan 27, 2016 · 2 comments
Closed

Info for migration guide to 2.1.0 #238

hisapy opened this issue Jan 27, 2016 · 2 comments

Comments

@hisapy
Copy link

hisapy commented Jan 27, 2016

The following info might come handy in Migration Guide to 2.1.0:

  1. Since React/ReactDOM are not globally exposed, you should import/require it in your "component" .js files or you'll have a "React/ReactDOM is not defined" when trying to render a <Component />
  2. npm install --save-dev babel-runtime (I had to do this to get react-on-rails running with my babel-% 5 libs)
@justin808
Copy link
Member

@hisapy:

With the new ReactOnRails api, you don't need to access React or ReactDom directly. Sure, if you have a webpack entry point that doesn't eventually lead to some some component, then you have bigger issues.

In terms of supporting babel 5, i'm not sure we want to do that. If you want to submit a PR with a doc for the docs/additional_reading/babel-5.md directory, I'll take that.

However, I'd recommend biting the bullet and getting on with babel 6!

@hisapy
Copy link
Author

hisapy commented Jan 28, 2016

Hi @justin808,
The following might be useful for people looking for a quick upgrade to 2.1.0

  1. What I meant is that if you adjusted your webpack config to NOT expose React and ReactDOM:
// The following import wasn't necessary when ReactDOM was exposed in webpack config
import ReactDOM from 'react-dom'; 
// other stuff here
let dom = ReactDOM.findDOMNode(this)
// other stuff here
  1. I upgraded an almost 3 month old app to react_on_rails 2.1.0 and we had to do it as fast as possible because of current deadlines. The only thing I had to do besides the stuff mentioned in the migration guide was npm install --save-dev babel-runtime. Currently my package.json looks something like the following
"devDependencies": {
    "babel-core": "^5.8.25",
    "babel-loader": "^5.3.2",
    "babel-plugin-react-transform": "^1.1.1",
    "babel-runtime": "^6.3.19",
    "react-transform-hmr": "^1.0.1",
    "redux-devtools": "^3.0.0-beta-3",
    "redux-devtools-dock-monitor": "^1.0.0-beta-3",
    "redux-devtools-log-monitor": "^1.0.0-beta-3",
    "webpack": "^1.12.2",
    "webpack-dev-server": "^1.12.0"
  },
  "dependencies": {
    "autonumeric": "^1.9.42",
    "classnames": "^2.2.0",
    "eonasdan-bootstrap-datetimepicker": "^4.15.35",
    "es5-shim": "^4.5.2",
    "es6-promise": "^3.0.2",
    "expose-loader": "^0.7.1",
    "history": "^1.17.0",
    "humps": "^1.0.0",
    "immutable": "^3.7.6",
    "imports-loader": "^0.6.5",
    "isomorphic-fetch": "^2.2.1",
    "jade": "^1.11.0",
    "jquery": "^2.2.0",
    "jquery-ujs": "^1.0.4",
    "lodash": "^3.10.1",
    "moment": "^2.10.6",
    "normalizr": "^1.3.1",
    "react": "^0.14.6",
    "react-color": "^1.3.5",
    "react-dom": "^0.14.6",
    "react-on-rails": "^2.1.0",
    "react-redux": "^3.1.2",
    "react-router": "^1.0.3",
    "redux": "^3.0.6",
    "redux-logger": "^2.4.0",
    "redux-simple-router": "^2.0.4",
    "redux-thunk": "^1.0.0",
    "reselect": "^2.0.2",
    "typeahead.js": "^0.11.1"
  }

I'll use Babel 6 in a new project starting today but for the moment our current project will have to wait (however I hope its current dependencies will work to build the bundle for production)

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

No branches or pull requests

2 participants