u/Apart-Scientist-8590

Do people still use var in JavaScript?

I usually see let and const everywhere, and I understand why they are preferred because they are block-scoped and safer.

But I also heard an opinion that var can still be useful when declaring variables inside a function, because it makes it clear that the variable belongs to the whole function scope and may be used across different blocks inside that function.

For example, let feels more natural for variables inside blocks like if, try/catch, loops, etc., while var could theoretically show that the variable is intended to be available throughout the function. Does anyone actually think about var this way, or is var basically avoided completely in modern JavaScript?

reddit.com
u/Apart-Scientist-8590 — 5 days ago
▲ 26 r/reactjs

I’m curious what architecture you typically use for medium to large React.js projects? Particularly in terms of code organization and folder structure.

I’ve noticed that many developers try to apply SOLID principles, but since React is primarily based on functional programming, these principles don’t always seem to fit naturally.

reddit.com
u/Apart-Scientist-8590 — 19 days ago