Hacker News new | ask | show | jobs
by starspangled 604 days ago
What do you use that good javascipt for? And what is the excessive stuff that causes slowness and bloat? I'm not a web programmer, just curious.
2 comments

My rule of thumb is to render HTML where the state actually lives.

In a huge majority of cases I come across that is on the server. Some things really are client-side only though, think temporary state responding to user interactions.

Either way I also try really hard to make sure the UI is at least functional without JS. There are times that isn't possible, but those are pretty rare in my experience.

Two examples that come up a lot for me:

1. filtering a drop down list by typing rather than scrolling through lots of options to pick one 2. Rearranging items with drag and drop

The excessive stuff is requiring a whole lot of scripts and resources to load before you display a simple page of information.

Doesn't the combo box input field already do this?
You are right, it does.

A better example would be dynamically loading the list of options where it is very long and loading the entire list would make the page size much larger.