title: React.js: After updating form, not able to get updated value (`componentWillReceive`) inside a component
body: <p>We get a form from the server that we allow the user to edit and are using lodash <code>_.set(object, path, value)</code> to update parts of that form depending on what part of the form the user updates.</p>
  
  <p>We are trying to get the current value by setting the state inside the component but getting this error;</p>
  
  <pre><code>Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops
  </code></pre>
  
  <p>Our function looks like;</p>
  
  <pre><code>onChange = ({ form }) =&gt; {
  const { path, editKeyword } = this.props;
  const inputValue = form[editKeyword];
  
  let prevForm = this.props.form;
  
  // update the object using
  const updatedForm = _.set(prevForm, path, inputValue);
  
  // action
  this.props.setCurrentForm(updatedForm); };
  </code></pre>
  
  <p>We also tried the following with no luck:</p>
  
  <pre><code>onChange = ({ form }) =&gt; {
  const { path, editKeyword } = this.props;
  const inputValue = form[editKeyword];
  console.log("input value ", inputValue);
  
  let prevForm = this.props.form;
  
  const updatedForm = _.set(prevForm, path, inputValue);
  
  // when we try to update local state
  this.setState({ form: updatedForm}) };
  </code></pre>
  
  <p>Has anyone had any luck with this?</p>