title: How to pass parameter to react native redux action?
body: <p>I am creating an application using redux. So I have created a store. Store also uses the <code>redux-thunk</code>. Then I have also reducer which manipulate the state and the actions for reducers.</p>
  
  <p>Now, I have an action called <code>doAuth.js</code> in which I want to just authenticate the user. But I am not able to pass email and password from my <code>Login.js</code> container.</p>
  
  <p>Here is what I have done so far : </p>
  
  <p>In my <code>Login.js</code>, I added below two functions and connected component to store : </p>
  
  <pre class="lang-js prettyprint-override"><code>const mapStateToProps = (state) =&gt; {
      return {
          authentication: state.authentication
      }
  }
  
  const mapDispatchToProps = (dispatch) =&gt; ({
      doAuth: (email, password) =&gt; dispatch(doAuth(email, password))
  })
  
  export default connect(mapStateToProps, null)(Login);
  </code></pre>
  
  <p>And I am calling the action from the button as following : </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;MButton 
      text="LOGIN" 
      onPress={() =&gt; this.props.dispatch(doAuth(this.state.email, this.state.password))}
  /&gt;
  </code></pre>
  
  <p>In above <code>this.state.email</code> and <code>this.state.password</code> contains the email and password from <code>Textinput</code>.</p>
  
  <p>Here is my action <strong>doAuth.js</strong> : </p>
  
  <pre class="lang-js prettyprint-override"><code>import axios from 'axios';
  import * as Types from '../constants';
  import Api from '../../config/Api';
  
  const doAuth = (email, password) =&gt; {
      return (dispatch) =&gt; {
          dispatch({
              type:Types.AUTHENTICATING
          });
          alert(JSON.stringify(email)); // It just alert "[object object]"
          alert(JSON.stringify(email)); // It gives me error "json.stringify cannot serialize cyclic structures react native"  
          const headers = {
              'Content-Type': 'application/json',
              'Authorization': Api.token
          }
          const data = {
              "email": "test@gmail.com",
              "password": "123456"
          }
          axios.post(`${Api.url}/login`, data, {headers}).then((response) =&gt; {
              dispatch({
                  type: Types.USER_FOUND,
                  data: response
              });
          }).catch((error) =&gt; {
              dispatch({
                  type:Types.AUTH_ERROR,
                  error
              });
          });
  
      }
  
  }
  
  export default doAuth
  
  </code></pre>
  
  <p>I also tried to passing <code>mapDispatchToProps</code> to connect as below but not working : </p>
  
  <pre class="lang-js prettyprint-override"><code>export default connect(mapStateToProps, mapDispatchToProps)(Login);
  </code></pre>
  
  <p><strong>Updated</strong></p>
  
  <p>Here is how I set email and password : </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;InputBox
      label="Email Address"
      placeholder="Type Here"
      returnKeyType={"next"}
      autoFocus={true}
      value={this.state.email}
      onChange={(email) =&gt; this.setState({email})}
  /&gt;
  &lt;InputBox
      label="Password"
      placeholder="Type Here"
      textContentType="password"
      secureTextEntry={true}
      value={this.state.password}
      onChange={(password) =&gt; this.setState({password})}
  /&gt;
  </code></pre>
  
  <p><code>InputBox</code> is custom component with <code>TextInput</code> with some extra styles.</p>
  
  <p>So please, anyone can help me how can I pass my email and password to action so I can authenticate using API.</p>