0

This is the function I'm trying to call from my function. It's erring on the last line here because selectedOption is undefined.

handleStatusChange(event) {
  console.log('status change event: ' + event.detail.value);
  event.stopPropagation();
  const { currentTarget, detail } = event;
  const { selectedOption, context } = detail;
  const { value, label } = selectedOption;

I think there's a hierarchy here: event has detail, detail has selectedOption, selectedOption has value.

In my function, I only care about passing 'value'. Why is selected selectedOption undefined?

    this.handleStatusChange({ 
      detail: () => {
        selectedOption: () => {
          value: 'Pitched'
        }
      },
      stopPropagation: () => {}
    });

1 Answer 1

0

() => {} is the Arrow function syntax. You haven't created objects, so much as functions. For normal objects, use {} instead:

this.handleStatusChange({ 
  detail: {
    selectedOption: {
      value: 'Pitched'
    }
  },
  stopPropagation: () => {}
});

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .