jeudi 18 novembre 2021

How to use useEffect hook with the dependency list as a specific field in an array of objects?

Let's say I have an array like this:

[
  {
    country: '',
    'city/province': '',
    street: ''
  },
  {
    country: '',
    'city/province': '',
    street: ''
  }
]

How do I have the useEffect() hook run every time the value of the 'country' field in any item inside the array changes?




Aucun commentaire:

Enregistrer un commentaire