r/Clojure • u/[deleted] • Mar 20 '21
Evolution of ReactJS vs Reagent (2013 - 2021)
https://www.youtube.com/watch?v=pd8kWJVDQD44
Mar 20 '21
const PizzaPreview = ({ pizzaType }) => {
const [quantity, setQuantity] = useState(0)
const increment = () => setQuantity(quantity + 1)
return (
<div>
<p>I luv {pizzaType} pizza</p>
<button onClick={increment}>Increment</button>
</div>
)
}2
3
u/backtickbot Mar 20 '21
4
u/Doombuggie41 Mar 20 '21
I'm newish to the clojure world after years of js development with a focus on React. I've always enjoyed FP and going from react's functional components to reagent was pretty effortless as a result. It's interesting to me that it took 8 years for react to get to what reagent envisioned on day 1 essentially.
That being said, it's not the full story. There's some weird nuances of if you want to use react hooks in reagent components wrt how they're invoked for example.
React and JS dev as a result has become a lot more "functionally oriented" over the last few years for sure. IMO React's biggest weakness is that it makes side effecting way too easy with useEffect. I don't really have what a good fix for it would be, but maybe it's to handle events differently than that. Things like re-frame offload it to a more fixed/opinionated event system. React has had this with things like Redux, but the boilerplate has always been a bit heavy and it has lost its favor with the React thought leaders. Things like `react-query` and `useSWR` are very nice, in that they allows you to treat ajax calls like a commodity and that's little boilerplate in setting them up.
0
Mar 20 '21
[deleted]
3
11
u/mac Mar 20 '21
Can't we poke a little fun at react/js and learn at the same time? What in your mind would be the top 3 things we could learn?
8
u/didibus Mar 20 '21
If I wanted to try and learn from JavaScript, what would be those things?
5
u/CanvasSolaris Mar 20 '21
Next.js is, in my opinion, the good standard for a front end framework. The tooling is really great
-2
12
u/mlengurry Mar 20 '21
I once worked with someone who thought I was an idiot for not knowing the latest syntax added to JS that year. He advised a client that it would be better to rebuild their app because it was 18 months old and now ‘legacy’.
The churn is often excused as ‘progress’ in JS land but it is real and it’s exhausting.
10
u/GuerreiroAZerg Mar 20 '21
I know the video is just for fun, but while React is the library that does all the magic, Reagent is a wrapper over that library. I may be wrong, but I think this is the fact that makes it possible to Reagent to stay the same for so much time