Beware of Vanilla JS
Tags: javascript, angular, webdev, productivity
Published: 2020-11-05 15:23:02

I like to paint miniature figures for [Star Wars](https://yj685.infusion-links.com/api/v1/click/4743827101057024/5570275139911680) (pics below for anyone who may be interested). It's about the geekiest of hobbies. The other day I was on a website buying custom bases for these figures. This site was out of the US, and the default currency was not US Dollars, but there was an option to switch the currency to US dollars so I did, and then I noticed this:

![image](https://cdn-images-1.medium.com/max/800/0*WgyR6_DDS5bl3Wp8?)

Look closely. What's going on here? That's not US dollars. US dollars show the currency before the number, and it uses a point not a comma to separate the integer from the decimal portion of a number. And how did this happen? Long story short, the developers decided to use a minimal amount of JavaScript and manage currency conversion and formatting themselves. And unfortunately, localization, like so many issues, has a lot of nuances that aren't obvious if you just learn a little. You have to dig deep and almost become an expert. A lot of currencies use commas and many use points, the placement of the symbol varies. Knowing these issues is just one of many things you have to worry about in building an app.

This is the value of front end frameworks. When they give you currency formatting tools, then someone has done all the research and you can reasonably trust that they'll get things right. In my free course on the [Fundamentals of Angular](https://yj685.infusion-links.com/api/v1/click/5068791993860096/5570275139911680) we cover the [currency pipe](https://yj685.infusion-links.com/api/v1/click/4799965024747520/5570275139911680) for formatting currencies, and it's surprising how many options there are for currencies. But that pipe means you don't have to worry about how to format currencies. Angular does it for you.

Ultimately this was a fairly minor issue, but nonetheless, it's indicative of something bigger. There's a fair amount of discussion of minimalism as our web apps initial download sizes get bigger and bigger and people push for better lighthouse scores.

So Do we need to use a framework for everything? No. And you can certainly find some library that handles currency for you. But that's only one issue. Even in a relatively simple issue, you'll have dozens of issues like that. Finding a different library for each issue is basically just piecing together a front end framework by hand.

This doesn't mean that every web application has to be built with React or another similar framework. But realize what you're giving up if you don't use a framework at all.

And in today's modern world there's a fair set of next generation minimalist frameworks you can use. Starting with [Preact](https://yj685.infusion-links.com/api/v1/click/4564478443913216/5570275139911680), which gives you 90% of React for 10% of the size, there's also Svelte, and recently [AlpineJS](https://yj685.infusion-links.com/api/v1/click/4715350343811072/5570275139911680) and [CrankJS](https://yj685.infusion-links.com/api/v1/click/5850920101085184/5570275139911680).

You still need to learn JavaScript. It's the underpinnings of everything you will do on the web, which is a good time to point out our new course, [JavaScript Fundamentals](https://yj685.infusion-links.com/api/v1/click/4516028025143296/5570275139911680). If you're a pro user you can access that course now.

But just [vanilla JS](https://yj685.infusion-links.com/api/v1/click/4624952606851072/5570275139911680) (hehe) by itself is a dangerous road to take.

As you make these decisions, being educated about the trade-offs can be very important. But the most important thing, as always, is to just build stuff and learn.

Happy coding!

Signup for my newsletter [here](https://thinkster.io/?previewmodal=signup?utm_source=devto&utm_medium=blog&utm_term=bewareofvanillajs&utm_content=&utm_campaign=blog).

Visit Us: [thinkster.io](https://thinkster.io?utm_source=devto&utm_medium=blog&utm_term=bewareofvanillajs&utm_content=&utm_campaign=blog) | Facebook: @gothinkster | Twitter: @GoThinkster

![image](https://miro.medium.com/max/700/0*7d8q9fuJr_TisQk9?)
![image](https://miro.medium.com/max/293/0*ftguBUluKVY5Jp-z?)
![image](https://miro.medium.com/max/700/0*BIrWdCgorly8rGR5?)
![image](https://miro.medium.com/max/700/0*wgn1ufTEkYpz0n80?)