title: How to pass parameters with redux-saga
body: <p>as an exercise for react-native &amp; redux-saga, I am trying to develop a little Weather-Application.</p>
  <p>While fetching and presenting the data works just fine, I somehow struggle to pass a parameter from a TextInput to the final API call.</p>
  <p>The goal for now is just to pass the cityName String to the fetchWeather function inside api.js and console.log it.</p>
  <p>Starting by <code>props.requestWeather(cityName)</code> inside Main.js</p>
  <p>I tried various things to pass the cityName via action and saga to the apiCall, only making me realize, that i was more guessing then anything else. Sadly the following research was not successful as well and so here we are.</p>
  <p>Any ideas on how to pass the String as a parameter and/or general criticism about the following redux setup would be highly appreciated!</p>
  <p>Dave</p>
  <p>Main.js</p>
  <pre class="lang-js prettyprint-override"><code>//[...] setCity Name to TextInput component
  const [cityName, setCityName] = useState('')   
  // [...] calling the action (inside onClickHandler)
  props.requestWeather() 
  //[...] 
  const mapStateToProps = state =&gt; ({
      weatherData: state.weatherData
  });
  
  const mapDispatchToProps = dispatch =&gt;
      bindActionCreators({ requestWeather }, dispatch);
  
  export default connect(mapStateToProps, mapDispatchToProps)(Main);
  </code></pre>
  <p>action.js</p>
  <pre class="lang-js prettyprint-override"><code>export const REQUEST_WEATHER = &quot;REQUEST_WEATHER&quot;
  export const RECEIVE_WEATHER = &quot;RECEIVE_WEATHER&quot;
  
  export const requestWeather = () =&gt; ({ type: REQUEST_WEATHER })
  export const receiveWeather = weatherData =&gt; ({ type: RECEIVE_WEATHER, weatherData })
  </code></pre>
  <p>sagas.js</p>
  <pre class="lang-js prettyprint-override"><code>function* getWeather(action) {
    try {
      const weatherData = yield call(fetchWeather);
      yield put(receiveWeather(weatherData));
    } catch (e) {
      console.log(e);
    }
  }
  
      
  function* watchAll() {
    yield all([
      //[...]
      takeLatest(REQUEST_WEATHER, getWeather),
    ]);
  }
  export default watchAll;
  </code></pre>
  <p>api.js</p>
  <pre class="lang-js prettyprint-override"><code>export const fetchWeather = async () =&gt; {
    const APPID = process.env.WEATHER_API_KEY;
  
    try {
      let weatherData = [];
      const weather1Promise = axios(
        &quot;https://api.openweathermap.org/data/2.5/weather?q=Rom&amp;APPID=&quot; + APPID
      );
      //[...]
      const [weather1, weather2, weather3] = await Promise.all([
        weather1Promise,
        weather2Promise,
        weather3Promise,
      ]);
      weatherData.push(weather1.data, weather2.data, weather3.data);
      return weatherData;
    } catch (e) {
      console.error(e);
    }
  };
  </code></pre>