Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Not working in new Reactjs Version #3

Closed
Writtscher opened this issue May 12, 2016 · 8 comments
Closed

Not working in new Reactjs Version #3

Writtscher opened this issue May 12, 2016 · 8 comments
Labels

Comments

@Writtscher
Copy link

I'm using the new react version and my simple example throws the https://fb.me/react-refs-must-have-owner error. Too bad 😔

import React from 'react';
import ReactDOM from 'react-dom';
import MetisMenu from 'react-metismenu';

ReactDOM.render(
    <MetisMenu content={[
        {icon: 'icon-class-name', label: 'Dashboard', href: '/'}
    ]} />,
    document.getElementById('application'));

@alpertuna
Copy link
Owner

@Writtscher Thanks for the report
Probably, it is a multiple (conflicting) copies of React loaded problem.
I will look into it.

@Writtscher
Copy link
Author

@alpertuna

Well, thank you for your quick answer. I'm pretty sure this is an easy fix as you are not the first vendor providing a react component 😏.

I'll check this tomorrow as well as I'm interested what the solution is. It's very late already to dive into it.

@Writtscher
Copy link
Author

I've checked your source code and your Item.js is probably causing this issue as you are using the ref attribute inside the render method. As you can read here

https://facebook.github.io/react/docs/more-about-refs.html

It is considered as bad practice to use ref there.

@alpertuna
Copy link
Owner

That is not a fancy ref usage, ordinary usage :). I tried and everything is expected. Can you let me know your browser module compiler configuration?

@alpertuna
Copy link
Owner

Ok, after updating dependencies, i got the same error, sorry for that.
Tomorrow I suppose to solve the problem.

@alpertuna
Copy link
Owner

alpertuna commented May 13, 2016

I got the problem and I think it is done now.
It takes me a lot of time but solution was simple. In module's package.json, react was under dependencies but it should be under peerDependencies. Since, it installs react as a sub module, and with your react, there were two reacts. So they conflicted. When I put it under peerDependicies, it does not install it as a sub module, instead informs you to install it. After then it uses your installed module, not its own sub module.
I have published it to npm register as well, you can install with npm.

@Writtscher
Copy link
Author

Nice one. Thank you for that. I'll use it in my project and will push pull requests as soon as something is missing ;). I've already some points that might be missing.

@alpertuna
Copy link
Owner

Ok I will be waiting for requests :)

@alpertuna alpertuna added bug and removed bug labels May 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants