eiriklv / react-masonry-component

A React.js component for using @desandro's Masonry
MIT License
1.44k stars 145 forks source link

React 0.14 compatibility #4

Closed rayshan closed 8 years ago

rayshan commented 9 years ago

Hi Eirik, thanks for building this. When using with React 0.14 RC1:

If using React.render(), the app works fine, but I get:

Warning: React.render is deprecated. Please use ReactDOM.render from require('react-dom') instead.
Warning: React.findDOMNode is deprecated. Please use ReactDOM.findDOMNode from require('react-dom') instead.

If importing ReactDOM and using ReactDOM.render(), the app does not work, I get:

Uncaught (in promise) Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).
eiriklv commented 9 years ago

Thanks, will take a look :-)

rayshan commented 9 years ago

I forgot to mention I'm using webpack.

The Invariant Violation can be fixed by either including React as an npm dependency and setting the version to >=0.13||>=0.14-alpha under npm 2, or using npm 3. Otherwise webpack bundles multiple copies of React.

The remaining issue is Warning: React.findDOMNode is deprecated. It should be an easy fix within this library.

fskinner commented 9 years ago

:+1: having the same issue. just did a Find All on my project and there no findDOMNode on my source code tho

eiriklv commented 9 years ago

Feel free to submit a PR for this :-) Will have to release a new major version since this will break backwards compatibility.

WellDone2094 commented 9 years ago

to solve this you need to use ReactDOM.render to render your root element,

ReactDOM.render(
       (<Body/>),
       document.getElementById('container')
);
Hancoson commented 8 years ago

need to use

<script src="../react-dom.js"></script>
ReactDOM.render()
afram commented 8 years ago

Fixed from v2.0.0