I remember following up the Angular tutorial. I was about 15min into the tutorial, and I was already editing 8 different files. I never got lost so quickly. I lost a job because I could not use angular, but never felt bad about it. I remember somebody commenting here on HN about a developer conference, where the speakers were bragging about their software being complex. This is an awful trend with software, and is re…
Oh, you want routing? "Not my business", says React. Go add a routing library. You want a framework for managing global state? Go find one. Want a kitchen sink frontend solution which bundles all of these commonplace features together? Use Create React App, or Next.js, or whatever fits your use case.
That's why I love React. The complexity of the solution matches the complexity of the problem.
Hello world:
const App = () => Hello world!
root.render();
Basic reactivity (output click event to console): const App = () =>
Composition & enumeration (dynamic bullet list!): const OneTwoThree = () => [1, 2, 3].map(i => {i})
const App = () => (
)
Set UI output data and CSS style based on asynchronous query results: const App = () => {
const [isGoogleUp, setIsGoogleUp] = useState(true);
const checkGoogleStatus = () =>
fetch('http://google.com')
.then((response) => setIsGoogleUp(response.ok))
.catch((err) => setIsgoogleUp(false));
useEffect(() => {
checkGoogleStatus();
}, []);
return isGoogleUp
? (Google is up!)
: (Can't reach Google.);
};
I can't imagine things being much simpler than this. No extra CSS files. No `Controller` classes. No janky, bespoke HTML "attributes" to make array loops or conditionals work. Just pure JavaScript (JSX optional) painting what you declare. That's my jam. I can't endure the agony of learning another damn template language or SomeCompany's (leaky) abstractions.