|
|
|
|
|
by hbrn
274 days ago
|
|
> React feels natural because it never asks you to stop writing JavaScript 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". |
|