157 points · by vlucas · 4y ago · 101 comments
To me, though, especially with hooks, React creates a bizarrely deep object tree that is impossible to reason about in comparison with pretty much every other tooling that exists.
- a cheap developer
I can’t stand it and find all the promotion on it to be promising far more than it delivers. It’s heavier, slower, less comprehensive, and less comprehensible than either Vue, Svelte, or most Vanilla JS implementations of component-oriented sites that I’ve seen.
Every single thing about React bothers me, from hooks to JSX (which is so much worse than meaningful templates), and I’d rather use something that makes me happy.
Millions of people and companies do. For mostly one reason: Getting started is incredibly simple. React's surface area is incredibly narrow. Almost anything in it is just JavaScript. Hooks or Classes? Syntax inside JSX? Just normal JavaScript. With hooks, there are basically two that can do 99% of what you want to do.
> which is so much worse than meaningful templates
Why? There is a zero bullshit approach here. No magic syntax. No "v-for" or two way binding. No receiver patters or context parameters.
IMO, Vue 3 has made a mistake buying into the whole hooks nonsense, and I find it less usable than Vue 2. On the other hand, Vue 3’s implementation is more comprehensible than React’s.
After working for a few years in reactive frameworks like Vue and Svelte, I feel I am longing for the simplicity of React now.
Idk, I found the svelte reactivity model a little confusing.
I agree with you about jQuery. It had its place. It’s painful to encounter now, especially since it can screw up any other framework that you want to put into a website.
The components I work on and write are all narrow in scope, self-contained and completely testable with no crazy side effects + minimal global scope.
The easy path on React is small functional components.
You can upgrade a 7 year old React app with very little fuss. Unfortunately, you cannot say the same about Vue or any of the modern libraries. They also have no track record to indicate they will exist 10 years down the line, but I'm pretty sure my React apps will still be fine.
That being said, I'm very excited about SolidJS[1] and the other modern libraries that use JSX.
I’m exceedingly unexcited about anything that uses JSX, which is a blight on the landscape.
Same thing any time WordPress does anything notable.
Teams make tech decisions based on multiple factors. Sometimes the ones like "bizarrely deep object tree that is impossible to reason about" are found to be less important. Because at the end of the day websites are for the wider public audience, who aren't affected by bike shedding
My life has been made a lot easier since I ditched Webpack for Vite. Faster build times, way less complexity, cleanly breaks up projects into small .js files on a per-route basis etc.
[0]: https://shopify.dev/custom-storefronts/oxygen [1]: https://github.com/lagonapp/serverless/
[0]: https://blog.cloudflare.com/workers-for-platforms/ [1]: https://shopify.dev/custom-storefronts/oxygen/worker-runtime...
Does that mean you want to roll out your own runtime in the future?
VanillaJS is very advanced nowadays.
Can you elaborate on what the difference is between Hydrogen and a custom theme? Other than the tooling and template language I’m struggling to understand the conceptual differences.
Custom themes allow you to template on top of the Shopify front end, giving you less control.
I am a backend developer and lightly familiar with what React bring in frontend development. I have not familiarity with Nextjs.
Given what I know, where does Hydrogen fits into the picture? Why shouldn't I stick to sever side rendered pages when developing Shopify app?
Thanks!
"Why shouldn't I stick to server side rendered pages?"
Hydrogen is still server rendered. Server components themselves never execute in the browser.
We're working to align with Vercel on improving the conventions of server modules (e.g. dropping the filename suffix): https://github.com/reactjs/rfcs/pull/189#issuecomment-111648... and we anticipate to release future versions of Hydrogen and Next.js that use something like boundary annotations instead.
To say this though, I prefer the file extensions bit, e.g. `.client.ts` and `.server.ts` over directives. Directives aren't super discoverable at a glance, and I think will lend themselves to a lot more headache in terms of engineering practice.
I realize its better for compilers probably, but it hinders DX for large applications IMO.
According to this mutation, you must renew the access token before it expires (presumably for just another 24 hours). So I don't think this solves the issue -- we want users to stay logged in for more than 24 hours -- aka logged in for like a month by checking a "keep me logged in" box.
https://shopify.dev/api/storefront/2022-04/mutations/custome...
What is the strategy for this basic use case?
Take a look at the hydrogen demo store, auth is implemented using the customer access token and Hydrogen’s CookieSessionStorage:
It looks like a very competent solution but would like to hear from actual users
As for hosting, you can deploy to Shopify's Oxygen platform (Worker-based), or any other deployment platform that supports Node.js or v8 Worker runtimes.
Vercel is my go-to choice to deploy my apps and it seems you are trying to support them too.
We have a working prototype of Hydrogen deploying to Vercel, and we need to formalize it into our official documentation: https://github.com/frandiox/hydrogen-vercel-edge
"hydrogen" has quite a specific meaning as a chemical element.
Shopify:Hydrogen might work, but why? It gives no clue about it's function, goals, or anything.
How about Shopify-React? Reactify? Shopiract? Use your brain, as I'm always telling my kids.
We tend to refer to the whole thing as the Shopify H2O stack.
I really like it, but I also named it. I can confirm brain was used, but maybe the wrong one.
Not sure if anyone noticed but "react" is a single common English word but somehow I never had any problem searching for it
-it's so popular millions of people use it, or
-it's so unpopular you know the entire userbase
The middle ground is the problem. For example a few years back I had a persistent bug/crash with Pix (mint's default image viewer then). Nothing on git or stack, and search engines didn't know what to do with it. "Pix image viewer" helped but not by a lot. I still don't know if it ever got fixed.
The name happens to pair nicely with Oxygen, our hosting platform: https://shopify.dev/custom-storefronts/oxygen
They're good names. Obviously if there is ever ambiguity, one would simply say "Shopify Hydrogen" or "Shopify Oxygen".
As if everything else isn't named with other random words... React, express, moment, chalk, gulp, path, jest, morgan, passport, and countless others. That's just npm packages. Rust? Elixir? Go???
Turns out we name things whatever we want and it doesn't pollute the global namespace because context exists.
We're meant to invent new words for everything? Talk about pollution... We definitely need more words like Shopiract! /s
These names work great for internal servers or services. Only.
> Use your brain, as I'm always telling my kids.
Proceeds to be mean.
Classic troll move op.
The periodic table of elements and Greek and Roman gods provides a nice list of cool sounding words that have likely been used elsewhere. Pick a random element. I'm positive even something like potassium is used somewhere.