r/javascript • • Jun 08 '21

The Plan for React 18

https://reactjs.org/blog/2021/06/08/the-plan-for-react-18.html
230 Upvotes

118 comments sorted by

View all comments

49

u/[deleted] Jun 08 '21

I want a discussion. I recently switched from a Svelte SPA project to a React one. I have been using React for like 2 years. And this was my first Svelte SPA.

I learnt svelte.dev/tutorial in 4 hours and then immediately jumped on a pretty complex project. Turns out. The learning curve wasn't even there. SFCs made code very visible and I have to worry less and less.

The recent project I am doing in React seems so bad in experience. What are your experiences regarding the same, guys?

24

u/MercDawg Jun 09 '21

I'm a big fan of React, but some developers just go down a rabbit hole.

Joined a team 2 years ago and it was like they never heard of reusable components. Majority of the code was repeated over and over again throughout the entire application. 80+ individual forms, all repeating the same painful repeated pattern. Unfortunately, this was meant to replace a legacy system and this new version had so many performance issues that were painfully time consuming to resolve. As I just had to use the legacy system recently, I actually prefer the legacy over the new version.

The current project I'm on is basically Higher Order Component hell. A "primary" component may have 7 HOCs wrapping it. One of those HOCs may have another 7-10 wrapping that. It is a nightmare. The API Layer is an absolute mess as it uses Redux to store a specific endpoints data for a one time use. No other component on the page/application ever uses that data. They probably have 100 "modules" wrapped around using Redux/Redux Observable all with their own reducer, actions, epics, and so forth, for literally a 1 to 1 data storage. If they want to use multiple components hitting the same endpoint, they use a HOC to create second store. Don't get me wrong - Redux is great, but this is not the best use of Redux and they brought on Recoil for "App State Management", so now we have both.

I get it. They did the best they could to solve the challenges they have, but some of it is rough.

9

u/acemarke Jun 09 '21

Oh dear. Yeah, that's definitely not how we recommend using Redux :(

I'd recommend showing our official Redux Style Guide patterns and practices page to that team:

https://redux.js.org/style-guide/style-guide

→ More replies (1)

4

u/tosho_okada Jun 09 '21

Feels like my last project lol

3

u/[deleted] Jun 09 '21

Reddit developer? 😅

3

u/960321203112293 Jun 09 '21

As someone who self learned react, the redux issue is surprisingly easy to slip into. I had one project where Redux made complete sense and then I caught myself just relying on it for no reason in another project. It's one of those libs you'll always have in your project, assuming you have things like user login info you want to use in multiple components; outside of that though, Redux is an absolute trap in most cases.

→ More replies (4)

43

u/fireball_jones Jun 08 '21 edited Nov 29 '24

narrow degree crawl brave compare intelligent chase dazzling work punch

This post was mass deleted and anonymized with Redact

0

u/[deleted] Jun 08 '21

[deleted]

8

u/fireball_jones Jun 08 '21 edited Nov 29 '24

public versed chunky rainstorm nail quiet wise smell paint carpenter

This post was mass deleted and anonymized with Redact

→ More replies (1)
→ More replies (1)

0

u/[deleted] Jun 08 '21

[deleted]

→ More replies (13)

14

u/r1ckd33zy Jun 09 '21

Same here. Learn Svelte in less than a day and was immediately proficient with it. Now when I look at React code all I can see is over-engineered complexity.

5

u/[deleted] Jun 09 '21

Used Svelte for solo projects, went to a small startup used it there, delivered results extremely quickly, back to a bigger company now, overly complicated React patterns. I'm sure there's a better way to use it but I would say my Svelte code could accomplish the same in 20% of the total lines.

5

u/stolinski Syntax.fm / Level Up Tutorials :upvote: Jun 09 '21

I feel the same. Sometimes things in Svelte are difficult only because you expect them to be harder than they are after working in React for so long.

22

u/[deleted] Jun 08 '21

Every single react project I worked in was an overengineered mess of redux, rxjs, several css in js solutions and slow as hell due to the amount of bloat it leads to in the long term.

I still don't see how this is better to more traditional approaches. It is just crazy. The app I'm working on is basically just a 3 step wizard and the amount of work it takes to do anything is insane.

Seeing these releases I just can't see complexity going down. All these features, server side components, lazy loading, concurrent mode... Is just too much... I don't see any benefit here anymore.

I like separations of concerns (ui from backend). Other than that, everything is worse in my opinion.

Sorry for the rant, I'm just tired of wasting time doing things that used to be so easy in this complicated way.

24

u/NovelLurker0_0 Jun 08 '21

While I agree some tools like Redux are unnecessary and wrongly used in some cases, you can't possibly say that

Seeing these releases I just can't see complexity going down. All these features, server side components, lazy loading, concurrent mode... Is just too much... I don't see any benefit here anymore.

These features are literally going to improve the quality, performance and UX of your apps without much impacting the way you already code. Those are features that are greatly welcomed and will help build better and less bloated apps. There are immense value in those.

3

u/[deleted] Jun 09 '21

I was talking in this case about the complexity inside react itself. It's like an operating system at this point.

3

u/aniforprez Jun 09 '21

I really love looking at the source code of projects. Django is one project that has beautiful, clear, readable code that I've actually gone into many times to understand and replicate certain functions directly myself

React is a fucking mess. Honestly most front-end frameworks are unreadable and messy but react is spectacularly messy. It's doing so much and so much of it is spread into so many tiny packages it's impossible to properly follow what's going on. Try reading what the useEffect hook is doing purely from source. It's crazy how these frameworks are so difficult to understand yet claim to be so simple

→ More replies (1)
→ More replies (4)

13

u/_Pho_ Jun 08 '21

Basically any use of RXJS has become my canary in the coal mine for “bad imperative over engineered React from people who don’t understand how rendering works”.

3

u/[deleted] Jun 09 '21

Can't agree more. We're doing just basic form submissions, and handling server errors, moving to next step, etc is a rela nightmare. I bet it is the wrong use case for it, but you know, the original team that wore this was "redux rxjs all the things" and then left, and here we are

→ More replies (1)
→ More replies (7)

22

u/CupCakeArmy Jun 08 '21

To put it mildly: I loved react for years but there absolutely no way back for me after svelte. We have multiple svelte projecta in production, big and small. React still in 2021 lacks support for the most basic features like styling. Yes there are approx. 9000 styling libraries, each with the "best next idea" on how to do styling. But they all trying to solving the same super basic Problem of CSS. And this is what it feels for anything between svelte and react. Form input binding, state management, event dispatching, etc, etc, etc. react was a great idea but we are definitely ready to move on. And oh hooks. They are so incredibly unintuitive for mom react people it's not even funny

16

u/ejfrodo Jun 08 '21

I feel the same about Vue. I used React for 5+ years and after playing with Vue I don't wanna go back, React can do everything but I've just always seen it become a convoluted mess of confusing libraries that you need a PhD in to understand. Meanwhile I can look at a Vue component or a Svelte component and just get what it does immediately because the syntax is so much more sensical (IMO), and I feel like often you can just do the same thing in Vue or Svelta with 1/2 as much code as React.

8

u/[deleted] Jun 08 '21

I guess you are talking about vue2 because vue3 composition api for me just made vue more complicated and i see people using hooks just like in react

11

u/ejfrodo Jun 08 '21 edited Jun 08 '21

I guess you haven't really tried to use Vue 3 :)

Vue 3 is backwards-compatible and the new composition API is entirely optional, you can keep using the old syntax if you'd like while getting a solid performance boost.

I really like the approach they've taken with Vue 3. You can use the more powerful code re-use and composition tools if you want and you get an experience more similar to React hooks using the composition API, but if you want the more simple Vue approach that many ppl came to like Vue for that's still available as well.

→ More replies (6)
→ More replies (12)
→ More replies (3)
→ More replies (22)