showing results for - "react call bind apply"
Lucas
16 Jan 2018
1.bind() is used to call a function with a given context. Using .bind() wont call the function, only modifies the context.
2
3.call() and .apply() will call the function immediately and modifies the context. The difference between the two:
4
5.call() accepts a list of values as its arguments
6.apply() accepts an array as its arguments
7Use .bind() when you want to modify the context but you want to call the function later.
8
9Use .call() or .apply() when you want to modify the context and you want to call the function immediately.