title: How can I use decorators in a React Redux application?
body: <p>I’m creating simple application using React Redux. I want to use decorator to inject some methods in my component.. I saw similar code in other projects:</p>
  
  <pre><code>import React, { Component } from 'react';
  import { connect } from 'react-redux';
  
  
  @creatable
  export default class BookDetails extends Component {
  
    render() {
      console.log(this.props);
      if (!this.props.Activebook) {
        return &lt;div&gt; please select book&lt;/div&gt;
      }
      return (
          &lt;div&gt;{this.props.Activebook.title}&lt;/div&gt;
      );
    }
  }
  
  
  function creatable() {
    return Create =&gt; {
      @connect(state=&gt;({Activebook : state.ActiveBook}))
     class MyDecorator extends Component {
       render() {
         console.log('&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;');
      console.log(this.props);
         console.log('&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;');
         return (
           &lt;div&gt;
             &lt;Create
                {...this.props}
             /&gt;
           &lt;/div&gt;
         )
       }
  
     }
      return MyDecorator;
    }
  }
  </code></pre>
  
  <p>Unfortunately the above code is not working. Why?</p>