Gary Sieling

Fixing React error: Invariant Violation: ReactClass: You’re attempting to use a component class as a mixin. Instead, just use a regular object.

Let’s say you convert an old React object-class to an ES6 object, resulting in the following code:

class MyComponent extends React.Component {
  render() {
    return 
Hello!
; } } React.createClass(MyComponent);

This can give you an error:

react-with-addons.js:20261 Uncaught Error: Invariant Violation: ReactClass: You're attempting to use a component class as a mixin. Instead, just use a regular object.

The correct answer is to use “MyComponent” directly, like so:

return 
Exit mobile version