🔀 refactor(inputListComponent): improve code readability and handle value conversion from string to array format
📝 WHY: The InputListComponent expects an array format for the value prop, but sometimes it receives a string instead. To prevent errors and ensure smooth operation, we need to handle the conversion from a string to an array with the string as its element. This refactor improves code readability and clarifies the purpose of the value conversion logic.
This commit is contained in:
parent
517816bd3b
commit
c6f6e2008e
1 changed files with 1 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ export default function InputListComponent({
|
|||
}
|
||||
}, [disabled]);
|
||||
|
||||
//Sometimes value is a string, but the InputListComponent expects an array, so we need to convert it when it's a string to an array with the string inside it to avoid errors
|
||||
// In certain cases, the value might be in string format, whereas the InputListComponent specifically requires an array format. To ensure smooth operation and prevent potential errors, it's crucial that we handle the conversion from a string to an array with the string as its element.
|
||||
typeof value === 'string' ? value = [value] : value = value;
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue