I want to create dynamic inputs for OTP login. but my useRef doesn't created.
//axios
api.post('auth/login', { mobile:_mobile}).then((res: any) => {
for(var i = 0 ; i < res.digits ; ++i){
inputs.push(i)
}
console.log("inputs",inputs)
inputRef = inputs.map(x => useRef(null));
console.log("inputRef",inputRef) //it doesn't called
var now = new Date();
now.setMinutes(now.getMinutes() + ( parseInt(res.expired_at)/60));
setExpiredAt(now.getTime())
showLoading(false);
toggleVerification(true);
}).catch(() => {
showLoading(false)
})
it doesn't called:
console.log("inputRef",inputRef)