2 ms·
The opposite of the rule of three and pattern detection is an instant detection stupid code (no funny acronym for that). An example of stupid code: let setX
by wruza 7y ago
The opposite of the rule of three and pattern detection is an instant detection stupid code (no funny acronym for that). An example of stupid code:
let setX = (e) => {this.x = +e.target.value}
... other setup ...
input({onchange:setX, value:this.x})
This code is not a subject of undry or rule of three, as it’s ratio of meaning to character count is too low.
And yet some frameworks make a decision to abstract it out at a wrong point:
let [x, setX] = ...
... other setup ...
input({
onchange:(e) => setX(+e.target.value),
value:x})
instead of clean and readable
input_num(this, 'x', {})
// or
this.input_num('x', {})