-
Notifications
You must be signed in to change notification settings - Fork 754
React.render is deprecated #432
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
Comments
Same issue here. |
Show us some code |
I'm running 1.5.0 without any warnings. I can think of a few things to try:
If those don't help you, please paste the full stack trace here -- that will show the exact line where the |
I'm using react-rails in combination with browserify-rails. I scanned the react_ujs code and I see where it is using React.render instead of ReactDom.render, so I just had to add sprockets import //= require react before //= require react_ujs and there is no more warning. But after //= require react_ujs I am also doing //= require components where I need to require React via node module system: var React = global.React = window.React = require('react'); I hope this does not compile two same versions of react library into application.js file and makes react code load twice. Need to check that. Thanks for the tips @rmosolgo Edit: React is loaded twice if i do this :( My setup is the same as suggested here #413 (comment). So to sum up, if I add sprockets directive //= require react above //= require react_ujs, react will be loaded twice. If I remove //= require react, all works fine, except that render function is not called on ReactDom object, instead it's called on React. Because it looks like ReactDom is not loaded before react_ujs.js is. https://github.com/reactjs/react-rails/blob/master/lib/assets/javascripts/react_ujs.js.erb#l57 I'm using latest sprockets gem (3.5.2), browserify-rails (1.5.0) and react-rails (1.5.0) |
Oh, moron me. I was setting the ReactDom variable instead of ReactDOM 👊 Issue solved :) @inchr , all you need to do is require ReactDOM. |
Sorry guys, I was offline for holidays... window.ReactDOM = require('react-dom'); (in my main.jsx, that is the entry point of webpack...I load react from webpack too, and I load the react-ujs after the bundle of webpack) |
@inchr If all good then close this issue. |
@lokeshjain2008 Oh sorry, my fault! I'm new in github! done! |
When I load a component with react-rails I get this warning:
Warning: React.render is deprecated. Please use ReactDOM.render from require('react-dom') instead.
Why ? I've checked and I'm running react-rails 1.5.0(that in theory is updated to react 0.14.3)
The text was updated successfully, but these errors were encountered: