Closed acusti closed 8 years ago
@acusti Good catch.
This has been discussed before https://github.com/cyclejs/todomvc-cycle/pull/14.
propHook
needs this
because that's how hooks work in virtual-dom
. TBH propHook
is a util. Could have been a library, then you wouldn't see the this
at all. It's a virtual-dom
thing, not a Cycle.js thing. I know virtual-dom
is part of Cycle DOM, but still, it's just one driver. Perhaps if we build a new Cycle DOM based on some other virtual DOM library that has a thisless API, then we can achieve that.
The point here is: as far as Cycle.js and RxJS is concerned, ignoring some corner cases in some drivers, there are no this
.
I'll update the docs page to remove the sentence "See it for yourself, this cannot be found in Cycle.js TodoMVC.". But that doesn't mean much in my opinion. You still rarely or never see a this
. What matters most, you don't need to think or reason about this
.
Apologies for this pedantic nitpick. With that disclaimer, I found this repo after reading the Cycle.js homepage, where it says:
The current implementation of
propHook
usesthis
, so I thought I’d propose implementing that utility differently to validate the “thisless JavaScript” assertion.