title: Checking if a value in the state is changed in class components
body: <p>The project is already started using class-based React and I can't switch to hooks.
  So I basically have a form, which could either be edited (there is data coming from the server that is supposed to fill the form with the last data it was filled with) or start a new one(which is empty, I don't need help with that).</p>
  <p>I have a variable in the state which checks for that: isEdit - checks if the form is being edited, or it's an empty start, a variable in the state called loadedCategories which is a number array and is being filled with categories ids from the last time the form was edited/created only isEdited is true.</p>
  <p>On the other hand, we have another var in the state: currentLoadedCategories, which is again a number array and is being filled only when there is a change made to the input field called Categories.</p>
  <p>Now the main issue is that I want when currentLoadedCategories is being changed, which will happen when the input is being changed, I want to empty currendLoadedCategories.</p>
  <p>I will give you an example with hooks since it's my strong side and I need your help to implement it with classes.</p>
  <pre><code>useEffect(() =&gt; {
  if(isEdit){
  setloadedCategories([]) 
  }
  }, [currentLoadedCategories])
  </code></pre>
  <p>Simply said all I want is to detect when something is being changed in the state, just like the example.</p>