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

Tab: browser throwing a warning - getInitialState #1863

Closed
Edrees opened this issue Jul 13, 2017 · 5 comments
Closed

Tab: browser throwing a warning - getInitialState #1863

Edrees opened this issue Jul 13, 2017 · 5 comments
Assignees
Labels

Comments

@Edrees
Copy link

Edrees commented Jul 13, 2017

Steps to Reproduce

  1. Using the Tab component and importing it to my page

Expected
The Tab should do this: there shouldn't be any errors or warnings

Result
The Tab does not do this: the browser gives a warning:

Warning: getInitialState was defined on Tab, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?

The Tab.js (in the semantic-ui-react node_module) is using getInitialState which is not used in ES6

getInitialState() {
    return { activeIndex: 0 }
}

Could you please help me with this if there is a way to fix this or is changing the syntax to ES6 by using constructor and assigning the state is the only way to go?
Thanks!

Testcase
If the docs show the issue, use: https://react.semantic-ui.com/modules/tab#tab-example-secondary-pointing
Otherwise, fork this to get started: http://codepen.io/levithomason/pen/ZpBaJX

@layershifter
Copy link
Member

What version of React do you use?

@Edrees
Copy link
Author

Edrees commented Jul 13, 2017

"react": "15.5.4"

@layershifter layershifter changed the title fix(Tab): browser throwing a warning - getInitialState Tab: browser throwing a warning - getInitialState Jul 14, 2017
@layershifter
Copy link
Member

Hm, I can't reproduce this on 15.5, however warning really exists on 15.4.

I will make PR.

@layershifter layershifter self-assigned this Jul 14, 2017
@Edrees
Copy link
Author

Edrees commented Jul 14, 2017

Thanks for your prompt responses! I tried if I can get rid of it by updating react to "15.6.1", but it didn't work and I still have the problem.

@Edrees
Copy link
Author

Edrees commented Jul 17, 2017

@layershifter @levithomason you guys are awesome and thanks for picking up this so fast and fixing it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants