3 ms·
>I'm not blaming react, everything else in the javascript space is just as bad right now. There's at least 4 different ways of loading modules (UMD, AMD, common
by romaniv 10y ago
>I'm not blaming react, everything else in the javascript space is just as bad right now. There's at least 4 different ways of loading modules (UMD, AMD, commonJS, es (babel) modules), 2 of which (require(), import .. from) are used within this example.
Personally, I got so frustrated with ever-increasing complexity of tools and growing networks of dependencies that whenever I can I try to package my JS code in self-contained modules/files that depend on nothing -- not even on one another. Needless to say, it's not an approach that's very popular, but it works remarkably well for websites of moderate complexity. One thing I'm sure of: using those modules feels far more satisfying than using a framework.
- softawre 10y agoSounds very anti-DRY, though I get where you are coming from.
- romaniv 10y agoAs far as DRY, the worst aspect of no-dependencies approach is dealing with AJAX. The rest of it is actually not that bad. After some experimentation, I separated the functionality into "behaviors", which are fairly reusable across different pages and projects.