title: right way to POST data to a server and handle response with redux
body: <p>I'm very new to react and redux.</p>
  
  <p>Now I want to rewrite my post request with a redux process.</p>
  
  <p>my current request looks like this:</p>
  
  <pre><code>  _handleSubmit(event) {
      axios
        .post('/createUrl', {
          url: this.state.url
        })
        .then((response) =&gt; {
          this.setState({
            shortenInfos: response.data
          })
        })
        .catch((error) =&gt; {
          console.log(error);
        });
  
      event.preventDefault()
    }
  </code></pre>
  
  <p>now I created a store:</p>
  
  <pre><code>export default function url(state = 0, action) {
    switch (action.type) {
      case 'CREATE_URL':
        // maybe axios request?!
        return `${action.url}/test`
      case 'CREATED_URL':
        return `${action.url}/created`
      default:
        return state
    }
  }
  </code></pre>
  
  <p>so where I must use my store.dispatch()? Should I make my _handleSubmit something like this?</p>
  
  <pre><code>_handleSubmit(event) {
    axios
      .post('/createUrl', {
        url: this.state.url
      })
      .then((response) =&gt; {
        store.dispatch({
          type: 'CREATED_URL',
          url: response.data
        })
      })
      .catch((error) =&gt; {
        console.log(error);
      });
  
    event.preventDefault()
  }
  </code></pre>
  
  <p>I think this is wrong? And where I must use mapStateToProps method? Or should I do the axios-request in my CREATE_URL in my reducer? </p>