className={`${classes ? classes : ''}${type === 'text' || type === 'number' ? 'input-default' : ''}${type === 'file' ? 'input-file' : ''}${type === 'checkbox' ? 'input-checkbox' : ''}${type === 'radio' ? 'input-radio' : ''}${type === 'password' ? 'input-password' : ''}`}
const isClassName = (type) => {
switch (type) {
case "file":
return "input-file";
case "radio":
return "input-radio";
case "password":
return "input-password";
case "checkbox":
return "input-checkbox";
default:
return 'input-default'
}
};
className = {`${classes ? classes : ''} ${isClassName(type)}`}
isClassName
напиши вне компонента const isClassName = (type) => {
switch (type) {
case "file":
return "input-file";
case "radio":
return "input-radio";
case "password":
return "input-password";
case "checkbox":
return "input-checkbox";
default:
return 'input-default'
}
};
const cl = []
if (classes) cl.push(classes)
cl.push(isClassName(type))
...
className = {cl.join(' ')}