To add to an input field the attributes with the values:
const attributes = { id: 'name', type: 'input',className:"text-center",name:"username",type:'text'k,required:'required' };
To implement:
<input {...attributes } >
The results will be:
<input type="text" id="name" ... />
Hope that works
Resource: https://stackoverflow.com/questions/50379381/dynamically-add-attributes-in-react-render-input