I am facing an issue while creating custom ref with clear input.
const api = useRef( [ ] );
api.current =fields.map((_, i) =>api.current[ i ] ?? createRef( ) );
case:
1.I have created a ref inside loop in ReactTags
exp:
<ReactTags
ref={api.current[index]}
/>
here [index] is the Index value of mappping statement
I have created a button to clear this input
<Button onClick={ ( )=>clear( index ) }>
clear Input
Whenever i will try to clear input it's working.
this is my clearInput function:
const clear = ( i ) => {
api.current[i].current.input.focus( )
} ;
I'm afraid I don't have capacity to debug individual implementations - if you believe you have found a bug please provide an isolated test case. If you are requiring technical support please try Stack Overflow.
Hi matt,
I am facing an issue while creating custom ref with clear input.
const api = useRef( [ ] ); api.current =fields.map((_, i) =>api.current[ i ] ?? createRef( ) ); case: 1.I have created a ref inside loop in ReactTags exp: <ReactTags ref={api.current[index]} /> here [index] is the Index value of mappping statement
I have created a button to clear this input <Button onClick={ ( )=>clear( index ) }> clear Input
Whenever i will try to clear input it's working. this is my clearInput function: const clear = ( i ) => { api.current[i].current.input.focus( ) } ;
This is my api ref response