Solo patrón de dígitos
ref={register({
required: true,
pattern: /^\d*$/,
validate: (value) => {
return !!value.trim();
},
})}
Himanshu Makwana
ref={register({
required: true,
pattern: /^\d*$/,
validate: (value) => {
return !!value.trim();
},
})}
console.log(`12331: ${/^\d+$/.test('12331')}`) // true
console.log(`abc: ${/^\d+$/.test('abc')}`) // false