title: persist the state of 'Like' counter using redux
body: <p>I am new to react, and I am trying to learn react and redux by myself.
  I have a like counter into my application. The intended behavior is to persist the number of likes after refreshing the page. I did implement the code and it works; however, when refreshing the page the counter resets to zero. I tried to create an action for patch request, but always gives me <code>×
  TypeError: Cannot read property 'params' of undefined</code>. Can anyone tell me what's wrong with my code?</p>
  
  <p>my schema for one item looks like that looks like that, where likes is an attribute of the item.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>{
  id: 1,
  title: "A new cake recipe",
  body: "Made of chocolate",
  likes: 0,
  created_at: "2018-07-06T14:48:23.377Z",
  updated_at: "2018-07-06T14:49:59.582Z"
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is my Likes component
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { Component } from 'react';
  import { connect } from 'react-redux';
  
  class Likes extends Component {
  
      constructor(props) {
  
          super(props);
          this.state = {
              likes: 0,
              updated: false
          }
          this.updateLikes = this.updateLikes.bind(this);
      }
  
      updateLikes() {
          this.setState((prevState) =&gt; {
  
              return {
                  likes: prevState.likes + 1,
                  updated: true
                  }
              })
              
      }
  
      render() {
  
          return (
              &lt;div&gt;
                  &lt;button 
                      className="btn btn-success" 
                      onClick={this.updateLikes}&gt;
                      Like &lt;strong&gt;{this.state.likes}&lt;/strong&gt;
                  &lt;/button&gt; 
              &lt;/div&gt;
          );
      }
  }
  
  function mapStateToProps(state){
      return {
          likes: state.likes
      }
  }
  export default connect(mapStateToProps)(Likes)</code></pre>
  </div>
  </div>
  </p>
  
  <p>this is my reducer</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const initialState ={
      likes: 0
  }
  export default function(state = initialState, action) {
      console.log(action.type)
      switch(action.type){
          case 'INC_LIKES':
              return {likes: state.likes + 1}
          default:
              return state;
      }
          
  }</code></pre>
  </div>
  </div>
  </p>