0

Take a look at the 2 lines below.

foo = ({ data: { one, two }}) => {alert(one.type); alert(two.type);}
foo( /* What goes here*/ );

What would I put in the () on the second line to alert "Hello" in the first alert() and "World" in the second alert()?

PHP_gEeK
  • 43
  • 5

1 Answers1

1

You need to call the foo function with an object that has data key. Data also is an object with two keys one and two

foo({
    data: {
       one: {type: 'one'},
       two: {type: 'two'}
    }

})

What you need to understand is that the foo component is using object destructing

Shubham Khatri
  • 270,417
  • 55
  • 406
  • 400