Occasionally, you have to break out of your normal cljs/FP flow and access whatever object
this refers to. In most cases, you’ll need to do so because:
- You’re interacting with a JS lib
- You’re using jQuery (e.g.
cljs provides the
this-as macro to access
this. When initially writing a line-reader, I used
this-as to access/set data on the transformer:
This is a departure from normal cljs in that we’re mutating the object referred to by
With React libraries like Om, Reagent, and Quiescent, I’ve used jQuery less and less. It’s rare that I need to access
this, but cljs makes it easy to do so when necessary.
Find this post useful? Share the love!