question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tab: browser throwing a warning - getInitialState

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
layershiftercommented, Jul 14, 2017

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

I will make PR.

0reactions
Edreescommented, Jul 17, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

getInitialState() is showing error in console - Stack Overflow
I am trying to create toggle menu for my react app. I am facing some issue with ' getInitialState() '. It's show error...
Read more >
Reactjs – Add custom props to a custom component – iTecNote
but then I get this warning in the browser: Warning: Unknown props popoverType on tag. ... React started throwing this warning as of...
Read more >
fx-team: changeset 224198 ... - Mercurial - Mozilla
readOnly attr will suppress a warning regarding this issue - // from the react lib. - var cx = React.addons.classSet; - return (...
Read more >
react-draggable - UNPKG
- Bugfix: Flow-type should no longer throw errors for consumers. 39, - It appears Flow can't resolve a sub-package's interfaces.
Read more >
chrome.tabs - Chrome Developers
Use the chrome.tabs API to interact with the browser's tab system. ... Unlike host permissions, activeTab does not trigger any warnings.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found