T
T
tytar2016-01-23 17:39:27
JavaScript
tytar, 2016-01-23 17:39:27

How to properly write mixins in es6 for Reactjs?

In plain ES5 style I wrote like this

var PostsConteiner = React.createClass({

    mixins:  [ Reflux.connect(PostStorage, "postList") ],

    render: function() {

But how to write it in this style?
export default class PostsConteiner extends React.Component {

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Gushchin, 2016-01-24
@tytar

Use https://github.com/brigand/react-mixin

S
Sergey Nalomenko, 2016-01-23
@nalomenko

ReactJS official documentation says ES6 syntax doesn't support mixins
Unfortunately ES6 launched without any mixin support. Therefore, there is no support for mixins when you use React with ES6 classes. Instead, we're working on making it easier to support such use cases without resorting to mixins.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question