by hbrn · 1y ago · 0 comments
I want to increment some counter on the webpage. Which approach feels natural?
increment = () => {
this.setState((prevState) => ({ count: prevState.count + 1 }));
};
const increment = () => setCount((count) => count + 1);
function increment() {
count += 1;
}
No one wakes up saying "please let me mutate simple state with function calls". function increment() {
count += 1;
dispatchEvent(new CustomEvent(
"count-incremented",
{ detail: { count } }
));
}
I think I prefer not having to manage events all over the place.Vue also isn't too far:
function increment() {
count.value += 1
}
In 2025, React state management is complete shitshow compared to Svelte and Vue.How in the world people are claiming "React is just Javascript" is beyond me.