In React.js I have a function which receives two parameters (id: string, User: UserDto), I want to use this function in two different components, on a first components, it works fine but on a second components, I need User to be not UserDto but UserDto[].
In my reusable function, how can I pass User so it can work as UserDto in one component and as UserDto[] in a second component?
You can modify component one to expect an array as well, and use the index 0 value passed to it. This would be fine, even if component one is only ever sent one value.
That way you can use the same function and pass the same parameters for both.