3 ms·
Given the ES3 style creation if components (which appears to have no "superclass"), can you also just do "class MyComponent" (no "extends React.Component"?)
by tolmasky 12y ago
Given the ES3 style creation if components (which appears to have no "superclass"), can you also just do "class MyComponent" (no "extends React.Component"?)
- danabramov 12y agoI think so, but you'll probably miss `this.setState`. They are moving out `setState` into a sideways module[1] so I assume full-featured classes without React.Component should be possible in the future. [1]: https://github.com/facebook/react/commit/ed7332c74921874cdcb3cce629bb5bd8c95a7968 https://github.com/facebook/react/commit/ed7332c74921874cdcb...
- danabramov 12y agoIndeed, it is not necessary to inherit form React.Component, see confirmation: https://github.com/facebook/react/pull/2975#issuecomment-72962088 https://github.com/facebook/react/pull/2975#issuecomment-729...