title: How to call a action creator in a functional component with react-redux?
body: <p>I'm learning react-redux. I am struggling a bit with the use of redux in functional components. How do I call an action from a functional component. I have seen some tutorials that use react hooks. Which makes sense to me. But these tutorials call action types and not functions that create action types.</p>
  <p>My case:</p>
  <p><strong>Wrapping container:</strong> Im passing from a wrapping container component that manages all data  the necassary props down to the <code>LoadedNavbar</code> function:</p>
  <pre><code>&lt;LoadedNavbar isAuthenticated = {isAuthenticated} profile = {profile} /&gt;
  </code></pre>
  <p><strong>Functional Component</strong>: A Navbar with a button to log out. The logout action should be called in the functional component.How do i make the action creator <code>logout</code> available in this function?</p>
  <pre><code>import React, { Component } from &quot;react&quot;;
  import { logout } from &quot;../../../../actions/auth&quot;;
  import { Link } from &quot;react-router-dom&quot;;
  
  export function LoadedNavbar (props) {
  
      const {isAuthenticated, profile} = props
  
  
    return (
  
     &lt;div&gt; 
  
     &lt;button onClick={this.props.logout} className=&quot;nav-link btn btn-info btn-sm text-light&quot;&gt;Logout&lt;/button&gt; 
  
     &lt;/div&gt;
  
     )
  }
  </code></pre>
  <p><strong>Action</strong></p>
  <pre><code>// LOGOUT USER
  export const logout = () =&gt; (dispatch, getState) =&gt; {
    axios
      .post(apiBase + &quot;/auth/logout/&quot;, null, tokenConfig(getState))
      .then(res =&gt; {
        dispatch({
          type: LOGOUT_SUCCESS
        });
      })
      .catch((err) =&gt; {
        dispatch(returnErrors(err.response.data, err.response.status));
      });
  };
  </code></pre>
  <p><strong>Reducer</strong></p>
  <pre><code>export default function(state = initialState, action) {
    switch (action.type) {
      case LOGOUT_SUCCESS:
      default:
        return state;
    }
  }
  </code></pre>