React front end field with one to many entity

Hi,
I have a question about management of field with one to many relation in React frontend:
Example:
Entity A{X, Y, Z[]}
Entity Y{L, Z[])

When i edit Entity A and i select a entity Y1 i would like that the select in entity A of Z options contains only options Z that have Y1 like relation and not all Z in dataset. How is possible with react? i tried with a useState var that will be setted after Y selection but the form dosent work right and anfter set command reset form fields, if i selec again the Y so it retain the choice.

For understanding if there is a entity A = appointment entity Y = customer entity Z = customer_animals

in entity A i have (customer, animals) when i select customer Y i would like to have a selection with only animals of customer Y. Maybe the design of entity isnt right?

Actually the only solution i had found is to use antd component and create mine formFields using useState

Thanks