2

I've seen the syntax noop => noop here. I was rather expecting something like () => noop to be valid. What does noop => noop stand for and when should one use this?

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Michael H.
  • 3,323
  • 2
  • 23
  • 31
  • `noop` is short for "no operation". It's a function whose output is its input _without any operation applied_. That's it. Though I'll admit, it's more typical to name the _function_ `noop` than it is to name its input and output `noop`. – Patrick Roberts Sep 24 '19 at 20:28

1 Answers1

4

noop => noop defines a function that takes a parameter named noop and returns that paremeter. It's the identity function.

There's nothing magical about the name noop; x => x would be equivalent. () => noop is not a valid function because noop wouldn't refer to anything.

Russell Davis
  • 8,319
  • 4
  • 40
  • 41