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

Invariant Violation: addComponentAsRefTo #7

Closed
dnbard opened this issue Jul 14, 2015 · 4 comments
Closed

Invariant Violation: addComponentAsRefTo #7

dnbard opened this issue Jul 14, 2015 · 4 comments

Comments

@dnbard
Copy link

dnbard commented Jul 14, 2015

I've put react-codemirror to my project just almost the same as it described in example:

var JSONBrowserPage = React.createClass({
    getInitialState: function(){
        return {
            options: {
                lineNumbers: true,
                mode: {name: "javascript", json: true}
            };
        };
    },

    render: function(){
        return (
            <Codemirror value={this.props.json} options={this.state.options}/>
        );
    }
});

and got next 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.

@steveluscher
Copy link
Contributor

Fixed in #9.

@unformatt
Copy link

I'm getting this error with React 0.14.7 and react-codemirror 0.2.5

@ktalebian
Copy link

Any update on this?

@velveret
Copy link

See https://gist.github.com/jimfb/4faa6cbfb1ef476bd105 for some of the fixes that have worked for other people. In my case, I had to make react external in webpack.

timsuchanek added a commit to timsuchanek/react-codemirror that referenced this issue Jan 31, 2017
@timsuchanek timsuchanek mentioned this issue Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants