I would like to conditionally fill a property based on the target type.
I need to do this inside an event handler for a form (react).
I would like an if/else statements situations that encompasses what I am trying to do in line 41 and 42, but I don’t know how.
How can I implement an if/else statement or a switch in object literals assigning?
As you can see from the image, I have tried nesting a ternary operator, while I am glad to see that it doesn’t show any errors in my code, it still does not work.
I was trying to use basic if/else statements but wasn’t succesful.