Search code examples
reactjsfirebasemixinses6-classreactfire

What is the correct way to use `Mixin` in `React` ES6


In ES5:

var TodoApp = React.createClass({
  mixins: [ReactFireMixin], //working fine
  ...
});

In ES6: (created using react cli )

class TodoApp extends Component {
    constructor(props) {
        super(props)
    }
    mixins= [ReactFireMixin] //not working
    ...
}

what is the correct way of doing this?


Solution

  • react-mixin solved my problem

    CODE:

    class TodoApp extends Component {
        constructor(props) {
            super(props)
        }        
        ...
    }
    reactMixin(TodoApp .prototype, ReactFireMixin);