1
const List = connect(mapStateToProps)(connectedList);

There is a function called "connect" being called with "mapStateToProps" as the argument, however there is "connectedList" surrounded by parenthesis right after the function calling. I haven't seen that before and I didn't find anything about that in the es6 articles I read for research.

1 Answers1

3

The connect function most likely returns another function that accepts one argument which is being invoked.

function getFunc(arg){
  alert(arg);
  return function(arg2){
    alert(arg2);
  }
}
getFunc("arg1")("arg2");//invokes the getFunc function and invokes the returned function
Unmitigated
  • 76,500
  • 11
  • 62
  • 80
  • Thank you very much. I thought it was a new syntax quirk but it's actually basic javascript functionality. I just never thought it would be so simple so I was actively searching for new stuff added to modern javascript. – Pedro Rodriguez Aug 20 '18 at 21:27
  • @PedroRodriguez No problem. – Unmitigated Aug 20 '18 at 21:27