Skip to content
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

Uncaught Error: Invariant Violation: removeComponentAsRefFrom(...) #648

Closed
mkawczynski07 opened this issue May 15, 2015 · 2 comments
Closed
Labels
core Infrastructure work going on behind the scenes

Comments

@mkawczynski07
Copy link

        function () {
            var React = arguments[1], Viewport = arguments[arguments.length - 1],
                    viewport =  React.createClass({
                        render: function(){
                            return <Viewport />;
                        }
                    });
            React.render(React.createElement(viewport), document.body);
        }

define(['react', '../../lib/material/raised-button'], function (React, RaisedButton) {
    return React.createClass({
        render: function () {
            return (
                    <div className="mui-app-canvas mui-predefined-layout-1">
                        <div className="mui-dark-theme mui-app-bar mui-paper mui-z-depth-0">
                        </div>
                        <div className="mui-app-content-canvas page-with-nav">
                            <div className="page-with-nav-content">
                                <RaisedButton label="test" primary={true} />
                            </div>
                        </div>
                    </div>
            );
        }
    });
});

Allways I have this error:
Uncaught Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created inside of another component's render method). Try rendering this component inside of a new top-level component which will hold the ref.

Also when i click on the button :
Uncaught TypeError: Cannot read property 'firstChild' of undefinedreact.js:13027 ReactMount.findComponentRootreact.js:12973 ReactMount.findReactNodeByIDreact.js:12462 getNodeFromInstancereact.js:19261 findDOMNodetouch-ripple.js:137 React.createClass._getRippleStyletouch-ripple.js:47 React.createClass.starttouch-ripple.js:109 React.createClass._handleMouseDownreact.js:3311 executeDispatchreact.js:17386 SimpleEventPlugin.executeDispatchreact.js:3296 forEachEventDispatchreact.js:3320 executeDispatchesInOrderreact.js:2693 executeDispatchesAndReleasereact.js:19388 forEachAccumulatedreact.js:2900 EventPluginHub.processEventQueuereact.js:11181 runEventQueueInBatchreact.js:11207 ReactEventEmitterMixin.handleTopLevelreact.js:11293 handleTopLevelImplreact.js:18360 Mixin.performreact.js:9633 ReactDefaultBatchingStrategy.batchedUpdatesreact.js:16593 batchedUpdatesreact.js:11387 ReactEventListener.dispatchEvent

@ezequiel
Copy link

@mkawczynski07 This has happened to me as well. I figured out it was because React was included twice on the page.

@mkawczynski07
Copy link
Author

@ezequiel thx. In one of my jsx file I had

"define(['../lib/react'], function(react){
...
})"

it seems that require loaded it two times. But strange is that, in the network inspector react was downloaded once.

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 25, 2022
@zannager zannager added core Infrastructure work going on behind the scenes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

No branches or pull requests

4 participants