Another library that bothers me by forcing the use of this is Mongoose, here's an example from its docs:
// define a schemavaranimalSchema=newSchema({name:String,type:String});// assign a function to the "methods" object of our animalSchemaanimalSchema.methods.findSimilarTypes=function(cb){returnthis.model('Animal').find({type:this.type},cb);};
There are also functions that you can't import and destructure, because of this.
I would also like to add that this is an implicit argument for your functions, hence it can decrease the readability and comprehension of your code. BTW, that's why I hate using HOCs in React, it is hard to see how things relate to each other.
I also noticed that in your bitcoin-all-time-high project you're using Moment.js, although it's a great library, I would like to recommend you a more functional friendly one: date-fns.
BTW, that's why I hate using HOCs in React, it is hard to see how things relate to each other.
Couldn't agree more. Render props partially fixes the problem but still you could get into pyramid of doom (unless you use a library like react-composer 😞)
Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
Totally agree. Render props is a great way to increase the visibility of your implementation by exposing values. I always go to a render props before a HOC.
It is a fun project. I can't wait for it to start tweeting again. Just gotta hit those all time highs again. lol
Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
moment has been my goto forever. So long in fact that I never bothered looking for another. date-fns looks very interesting. thanks for the recommendation, I'll check it out!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article! Completely agree with you.
Another library that bothers me by forcing the use of
this
is Mongoose, here's an example from its docs:There are also functions that you can't import and destructure, because of
this
.I would also like to add that
this
is an implicit argument for your functions, hence it can decrease the readability and comprehension of your code. BTW, that's why I hate using HOCs in React, it is hard to see how things relate to each other.I also noticed that in your bitcoin-all-time-high project you're using Moment.js, although it's a great library, I would like to recommend you a more functional friendly one: date-fns.
Thank you for writing!
Couldn't agree more. Render props partially fixes the problem but still you could get into pyramid of doom (unless you use a library like react-composer 😞)
And wow, bitcoin-all-time-high looks like a fun project. 💪
Totally agree. Render props is a great way to increase the visibility of your implementation by exposing values. I always go to a render props before a HOC.
It is a fun project. I can't wait for it to start tweeting again. Just gotta hit those all time highs again. lol
moment
has been my goto forever. So long in fact that I never bothered looking for another. date-fns looks very interesting. thanks for the recommendation, I'll check it out!