3 ms·
I think you're missing the point. People who say that are talking about messy code that needs clarification from comments – those cases likely need to be rewrit
by maleldil 4y ago
I think you're missing the point. People who say that are talking about messy code that needs clarification from comments – those cases likely need to be rewritten to be clearer. This is entirely unrelated to _why_ the code does what it does, which the issue here. That definitely needs comments when it's not obvious.
- strager 4y agoIn the OP's case, the _why_ can be encoded in function names. For example: function DatePicker() { function handleDateChange(event) { preventDialogFoobarFromClosing(event); ... } return ( <ThirdPartyDatePicker onChange={handleDateChange} /> ); } function preventDialogFoobarFromClosing(event) { event.preventDefault(); }