title: React how to convert string to object property
body: <p>In a React project, I want to dynamically access an object property name using a string variable I pass through props. I am able to pass a value as string; however, when I try to use it to access the object property it doesn't work.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>const passedField = 'title'; // this comes from props
  const book = { title: 'Sample title', content : 'some content' };
  book.passedField; // returns undefined
  </code></pre>
  
  <p>I access title like this <code>book.title</code></p>
  
  <p>I want to access it like <code>book.passedField</code> but I get undefined on console. </p>
  
  <p>How can I achieve this?</p>