react: Cannot use addons.Perf or addons.ReactTransitionGroup in AMD environment with 15.4.1
I use react-with-addons in a RequireJS enviroment. If I try to use React.addons.Perf, I get a ReferenceError: ReactDOM is not defined from https://github.com/facebook/react/blob/15-dev/src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js#L26.
This is a regression from 15.3.x.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 43 (1 by maintainers)
Commits related to this issue
- downgrade React, 15.4.x is broken see https://github.com/facebook/react/issues/8392 — committed to eddyson-de/tapestry-react by jochenberger 8 years ago
Should be fixed via #8686 and released in 15.4.2 (out soon).
RequireJS : http://codepen.io/jochenberger/pen/dOQeqw
It might even be enough to apply this patch:
The change would probably have to be made in https://github.com/facebook/react/blob/master/src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js
I’m also using RequireJS and while 15.4.1 fixed the ability to use ReactDOM, I am unable to use
React.addons.TestUtils.renderIntoDocument()for probably the same reasons as above.renderIntoDocument makes use of
ReactAddonsDOMDependencies.getReactTestUtils()which looks for the same undefined ReactDOM variable that ReactPerf and other addons are looking for I believe.Thanks for getting the 15.4.1 fix out so quickly, by the way.
@gre
The whole concept of “addons” that reach into internals is a mess IMO.
I think React Native has its own
ReactPerfcopy now but I’m not sure if it’s exposed. You can probably get it withrequire('react-native/lib/ReactPerf');or maybe justrequire('ReactPerf')(not sure how Haste works in RN projects).We should probably expose it on renderers since it’s copied now. Like
ReactDOM.PerfandReactNative.Perfor something.