←back to thread

Svelte 5 Released

(www.npmjs.com)
390 points begoon | 1 comments | | HN request time: 0s | source
Show context
h_tbob ◴[] No.41891691[source]
I don't understand how React is so popular, still. With Svelte and Vue, I don't think anybody should do a new project with React.
replies(6): >>41891956 #>>41892093 #>>41892799 #>>41893733 #>>41895645 #>>41896081 #
esperent ◴[] No.41892093[source]
I'm building a React app from scratch and since I have control this time, I'm following a strict pattern: all data manipulation (∆) happens outside of React components, and the components themselves are as lightweight as possible.

I feel like this change suddenly makes everything about the React paradigm make sense - it can be just a view layer, and when used that way, it works great.

But I can't say I've ever worked on a React app that followed this this pattern before. Perhaps this is React's fault, or perhaps it would be the same with every framework once an app gets big enough (in my limited experience with Vue and Angular, those didn't seem any different from React in this regard).

(∆) By data, I mean the data that is fed into the app from the database. There's a certain amount of data generated internally by components, I write small functional functions at the top level or in the same folder as the components to handle that, but not placed inside the component itself, which is common practice but ends up creating these huge hard to parse components.*

replies(4): >>41892221 #>>41893728 #>>41896087 #>>41896112 #
jbhoot ◴[] No.41893728[source]
> all data manipulation (∆) happens outside of React components,

I do something similar. State and its management lives outside the React components, which only consume this state via hooks. Keeping the state in chunks, and outside the tree lets me access a chunk of state only in the components that need it.

This results into minimum amount of re-rendering of components. Component code also looks cleaner and easier to read.

replies(1): >>41895783 #
datavirtue ◴[] No.41895783[source]
This many years on and we are still trying to figure out state management. Wasn't React designed for the view?
replies(1): >>41902861 #
1. jbhoot ◴[] No.41902861[source]
The marketing has kept changing.

I have always found state management easier in React if I keep it out of React.