title: Using two useeffect react hooks
body: <p>I try to use react with hooks. I have this state:</p>
  
  <pre><code>const [state, setState] = useState&lt;State&gt;({
      titel: "",
      somethingElse: "",
      tabledata: [],
  });
  </code></pre>
  
  <p>I have two useeffect:</p>
  
  <pre><code>// componentDidMount, Initial variable deklaration
  useEffect(() =&gt; {
      //Do something
  
      //Set initial states
      setState({
          ...state,
          titel: props.titel,
          somethingElse: props.somethingElse,
      })
  
  }, []);
  
  // Similar to componentDidMount and componentDidUpdate:
  useEffect(() =&gt; {
  
      //Do something and generate tabledata
      let tabledata ....
  
      //Set tabledata
      setState({
          ...state,
          tabledata: tabledata,
      })
  
  }, [props.taenzer]);
  </code></pre>
  
  <p>Now I have the behavior, that the second useeffect is overwriting the first useeffect setState command.
  My variable titel and somethingElse is always empty.</p>
  
  <p>Now I could change my deklaration of state, something in this way:</p>
  
  <pre><code>const [titel, setTitel] = useState&lt;&gt;({
      titel = ""
  });
  const [somethingElse, setSomethingElse] = useState&lt;&gt;({
      somethingElse = ""
  });
  </code></pre>
  
  <p>But this makes the whole unclear and it is not so easy to set the state of several variables in one time like we could with setState(...state, titel="Hello", somethingElse="Else")</p>
  
  <p>Any other possibility?</p>