React.js component within Polymer element: errors on every mouse/wheel/key event


Polymer 0.1.1 and React.js 0.8.0.

Reduced case: giving errors like this on every mouse/wheel/key event:

"TypeError: Cannot set property target of #<v> which has only a getter
  at b.<anonymous> (
  at t (
  at s (
  at p (
  at HTMLDocument.o (" 

It looks like Polymer's events.js are clashing with React's synthetic events.

The error stack ends here (react.js:7794):

  // TODO: Remove when synthetic events are ready, this is for IE<9.
  if (nativeEvent.srcElement &&
      nativeEvent.srcElement !== { = nativeEvent.srcElement;

The problem is probably that nativeEvent is actually wrapped by Polymer. According to the // TODO: note, this might not be an issue in future versions of React.

By : forresto


This isn't in a React release yet, but that code was removed two months ago:

If you build a copy of React off of the current master (npm install; grunt build), you shouldn't see the error any more.

This video can help you solving your question :)
By: admin