I personally don't like this style. It makes it harder to read the code. If someone misses that `var Blur = this` line, they could get confused and either not use it, or use it incorrectly.
Instead, since you're using ES6, I suggest using the fat arrow:
(I'm used to writing Coffeescript instead of ES6, so sorry if minor syntax details are wrong.)
This is largely a stylistic choice. You can feel free to do things however you want, and if it works, it works. But generally I prefer to make sure things are really clear, and that the Javascript features aren't obscured.
Re:Show HN: React component for blurred backgrounds
by lfuller on Friday April 03, 2015 @07:05PM
(#9319111)
By using arrow functions it's simply implied that the top level context is always being used. You don't have to define what "this" is, since it's always "this".
I noticed that you're caching `this` as a variable:
And it looks like you're doing so to avoid scope problems in anonymous functions: I personally don't like this style. It makes it harder to read the code. If someone misses that `var Blur = this` line, they could get confused and either not use it, or use it incorrectly.Instead, since you're using ES6, I suggest using the fat arrow:
(I'm used to writing Coffeescript instead of ES6, so sorry if minor syntax details are wrong.)This is largely a stylistic choice. You can feel free to do things however you want, and if it works, it works. But generally I prefer to make sure things are really clear, and that the Javascript features aren't obscured.