Skip to content
Discussion options

You must be logged in to vote

@Rathalin

Function append always add item at the end of field array. You just need to watch on change of fields object from useFieldArray hook to get last item and set focus on it.

For example:

useEffect(() => {
   setFocus(fields[fields.length - 1].id);
}, [fields])

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Rathalin
Comment options

Answer selected by Rathalin
Comment options

You must be logged in to vote
1 reply
@Rathalin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants