Well, its not abour redux or javascript. Its "magic number" pattern dated back to C language, even assembler (for example here https://www.viva64.com/en/l/0009/).
Not really. Just naming a magic number doesn't make it less magical.
setTimeout(foo, 1000)
vs
var oneSecond = 1000;
setTimeout(foo, oneSecond);
vs
var timeToWaitForNetwork = 1000;
setTimeout(foo, timeToWaitForNetwork);
His point in the article is that it just adds more complexity that you now also have a variable named the same thing as a string. And without any real benefit.
2
u/ArcanisCz May 15 '17
Well, its not abour redux or javascript. Its "magic number" pattern dated back to C language, even assembler (for example here https://www.viva64.com/en/l/0009/).