title: How to extract value from JSON object in React?
body: <p>I have a case where my JSON object needs remapping first e.g. from
  <code>{ name: goals, value: 65 } to { goals: 65}</code>. I believe I achieved that with reduce in getStats function (see screenshot from the console) </p>
  
  <p>However I want to wrap it in a function i.e. <code>getData(name){}</code>
  where I will be passing <code>name = 'goals'</code> and get the specific value 65</p>
  
  <p>How to achieve that and simplify my code?</p>
  
  <p><a href="https://i.stack.imgur.com/aVJdU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aVJdU.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/UOOIa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UOOIa.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/de2zU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/de2zU.png" alt="enter image description here"></a></p>