thom4parisot / Imager.jsx

A React component for responsive images in desktop and mobile browsers. Featuring Imager.js.
https://npmjs.com/imager.jsx
MIT License
32 stars 7 forks source link

react 0.13.2: Can't add property context, object is not extensible #12

Closed joernroeder closed 9 years ago

joernroeder commented 9 years ago

Hey, after upgrading to react 0.13 i'm getting the following warnings and error:

Warning: Component(...): No render method found on the returned component instance: you may have forgotten to define render in your component or you may have accidentally tried to render an element whose type is a function that isn't a React component.

Warning: Don't set the props property of the React element. Instead, specify the correct value when initially creating the element.

Error: Can't add property context, object is not extensible

I think it has something to do with the breaking changes made in react 0.13 https://facebook.github.io/react/blog/2015/03/10/react-v0.13.html#react-core

Deprecated patterns that warned in 0.12 no longer work: most prominently, calling component classes without using JSX or React.createElement and using non-component functions with JSX or createElement

Do you have any idea how to fix this?

DavidBruant commented 9 years ago

(I had the same error a minute ago and we solved it. Found this issue along the way. Hi @oncletom !)

@joernroeder, how does your calling code look like? Are you using JSX?

You might have a React.createFactory laying around that you want to remove. It is unnecessary and results in the error you experience in React 0.13.x with JSX.

This page describes how the different types fit together. The only not-missing-but-discrete info that is worth making more explicit is that: factoryFunction is a ([object props]) => ReactElement function. In a nutshell, you're certainly experiencing a type mismatch error (yay JS!)

thom4parisot commented 9 years ago

Hi @DavidBruant :-D

Do I need to fix anything here in the end?

DavidBruant commented 9 years ago

Do I need to fix anything here in the end?

As far as I know, you don't. I would guess the problem can be only noticed and solved by consumers directly. Let's wait for an answer from @joernroeder.

gasi commented 9 years ago

Thanks, @DavidBruant for outlining the problem of unnecessary createFactory. I converted an existing component from CoffeeScript to ES6/ES2015 using JSX and ran into this because I previously used createFactory. I wonder if the React team could improve the error messages to point in this direction (unnecessary createFactory) :smile:

/cc @zpao @spicyj

sophiebits commented 9 years ago

@gasi Can you file an issue?

gasi commented 9 years ago

@spicyj Yes, of course, should have done it right away :smile: https://github.com/facebook/react/issues/5039

thom4parisot commented 9 years ago

Ace! Closing the issue as it is now filled in the right repo :-) Thanks for having raised it and @DavidBruant for sharing the solution with us!