<story><title>When I use classes, when I don’t, what I do instead and why</title><url>https://blog.kentcdodds.com/classes-complexity-and-functional-programming-a8dd86903747</url></story><parent_chain></parent_chain><comment><author>nulagrithom</author><text>Understanding &amp;#x27;this&amp;#x27; in JavaScript is simply table stakes at this point. You and anyone else who touches your JS code should have a decent grasp on &amp;#x27;this&amp;#x27;. Citing &amp;quot;complexity of this&amp;quot; while using React is just absurd in my opinion...&lt;p&gt;&lt;i&gt;You Don&amp;#x27;t Know JS: this &amp;amp; Object Prototypes&lt;/i&gt; cleared it up nicely for me.[0] Love the series in general too.&lt;p&gt;Also -- and I&amp;#x27;m not sure how it&amp;#x27;s typical done when taking a functional approach -- where do these functions &amp;quot;live&amp;quot;? What if we want to use a Person in another module&amp;#x2F;component&amp;#x2F;whatever? Do we basically just have a collection of &amp;quot;static&amp;quot; functions on a helper class that we&amp;#x27;re going to be using? I&amp;#x27;m not sure that&amp;#x27;s a real gain. Would rather see the functions available on the Person itself (though maybe that&amp;#x27;s just my OOP ways talking).&lt;p&gt;And then there&amp;#x27;s the &amp;quot;pure function&amp;quot; part. Without explicit documentation and no other knowledge of this individual&amp;#x27;s functional predilections, I would be surprised when the setName function actually creates an entirely new Person and then sets it name.&lt;p&gt;I don&amp;#x27;t know. I really do enjoy functional approaches, but I don&amp;#x27;t think avoiding &amp;#x27;this&amp;#x27; is a good reason, and I feel like the example given isn&amp;#x27;t the best scenario to illustrate.&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;getify&amp;#x2F;You-Dont-Know-JS&amp;#x2F;tree&amp;#x2F;master&amp;#x2F;this%20%26%20object%20prototypes&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;getify&amp;#x2F;You-Dont-Know-JS&amp;#x2F;tree&amp;#x2F;master&amp;#x2F;this%...&lt;/a&gt;</text></comment>
<story><title>When I use classes, when I don’t, what I do instead and why</title><url>https://blog.kentcdodds.com/classes-complexity-and-functional-programming-a8dd86903747</url></story><parent_chain></parent_chain><comment><author>acdha</author><text>It seems odd to read something written in 2017 about the confusion from using `this` which only mentions arrow functions briefly in passing. A fairly high percentage of discussion on that issue could be replaced with “use an arrow function, it works the way you expect”, and browser support should be basically the same as ES6 classes – doesn&amp;#x27;t work in IE11 but multiple tools are available for backwards compatibility.</text></comment>