React Hook Forms provides a method append() on useFieldArray to add more rows to the dynamic fields array.
I'm able to use append(). However, I want to execute another function immediately after calling append(). But that's not happening. Instead, the next function gets called before append() is completed.
How can I change this behavour and ensure that the next function will be called only after append() is completed?
https://react-hook-form.com/api/usefieldarray
In the following example:
onClick={() => {
                    console.log('fields 1', fields)
                    append({
                      item: 
                        {
                          id: 1, 
                          name: 'test'
                        }
                    });
                    console.log('fields 2', fields)
                    }}>
In the above example, the length of fields remains the same. It doesn't increase. How do I resolve this?
 
    