title: What is the best practice approach to getting data from the redux store into a simple function?
body: <p>Say I have a function called <code>calculateFees</code>, which needs some data sent from the backend such as <code>consultingFee</code>. It would look something like:</p>
  
  <p><code>const calculateFees = itemPrice =&gt; itemPrice * [consultingFee]</code></p>
  
  <p><code>[consultingFee]</code> is a placeholder, as I am not sure how to get it from the redux store. Let's also say that <code>calculateFees</code> is far more complicated, that has about 10+ types of fees, and is used by dozens of components. The options I could think of are:</p>
  
  <p>1) Pass in all the fees from the class that calls it that is connected to the redux state. </p>
  
  <p>(e.g. <code>calculateFees(itemPrice, feeOne, feeTwo, FeeThree, ...)</code></p>
  
  <p>2) duplicate the code in each class that is connected to the redux state.</p>
  
  <p>3) export the entire store (or part of it), so that the <code>calculateFees</code> function can access the data via import.</p>
  
  <p>4) Not sure if this is even possible, but create a class with static methods, and connect it to the redux store. And then use it such as <code>MyCompanyFees.calculateFees</code>.</p>
  
  <p>5) Create a thunk that solely pulls data out of state, and returns the calculated fees. It doesn't seem correct to use this, as it isn't asynchronous, nor does it update the state tree.</p>
  
  <p>I wanted to get some guidance / suggestions on the best practices approach, as I am not a fan of 1, 2 or 3.</p>