Live data from Hacker News

Ask HN: How can we make React better?

news.ycombinator.com

11–20 of 68 posts

Re: Ask HN: How can we make React better?

#11

Earlier quoted context omitted.

I actually found a bug last week with React's styling logic. I haven't submitted a bug report yet because, well, I'm lazy. But if OP reads this comment, I outlined it here: https://stackoverflow.com/questions/52636618/modifying-react...

God, this is one of my pet peeve issues. I swear we'll fix it someday. https://github.com/facebook/react/issues/6348

Ha! Glad that it's known, at least.

Re: Ask HN: How can we make React better?

#12
post #6

as long as facebook owns it and controls the licensing I will be using Vue over react.

Is there a particular concern you have? React is MIT licensed (same as Vue), and there's no way for Facebook to take back that license from you.

(React could stop being developed, as could Vue. In both cases, you or anyone else could pick it up and build upon the last version.)

Re: Ask HN: How can we make React better?

#13
At this point, I'm quite satisfied with React and use it for most of my new JavaScript UIs. A few potential improvements that come to mind:

1. More strictness in terms of what is and is not valid JSX. Just today I was working on a React Native app that compiled for iOS but not Android. The issue ended up being a stray semicolon, leading to syntactically incorrect code that allowed for a valid iOS build anyway. I would expect it to fail regardless of environment. The error was also very cryptic although this probably has more to do with React Native than React [1].

2. More proactive warnings at runtime for development builds. React does a great job at telling me what I'm doing wrong; I'd also like it to tell me what I could be doing better. Some ideas are cyclomatic complexity warnings to detect when there is too much branching logic in a component or warnings that indicate that a component is getting too large and could be refactored.

3. Rebuilding the virtual DOM in WebAssembly. Now this might be excessive as React performs quite well in my experience. But it could lead to performance and portability benefits as well as just be a cool project to work on. Mozilla published an article today regarding gains in JS and WebAssembly interop performance; check it out if you haven't [2].

[1] https://github.com/facebook/react-native/issues/13243

[2] https://hacks.mozilla.org/2018/10/calls-between-javascript-a...

Re: Ask HN: How can we make React better?

#14
Size. For my use case of a hybrid mobile app where I'd like to render lightweight webviews, the overhead of react is far too great.

For this i'll actually reach for Preact instead. Or perhaps even the relatively new Svelte (disappearing) framework.

Re: Ask HN: How can we make React better?

#15
post #14

Size. For my use case of a hybrid mobile app where I'd like to render lightweight webviews, the overhead of react is far too great. For this i'll actually reach for Preact instead. Or perhaps even the relatively new Svelte (disappearing) framework.

Thanks for the feedback! We've found that in most cases the components you've built tend to be much larger than React itself, and indeed if we can reduce the size of your components by adding things to React then that is often a good tradeoff for us.

However we do try to keep the size down; for example React 16 included a 30% size reduction.

When you say "the overhead of react is far too great" are you speaking from something you tried that didn't work? I haven't heard any stories like this so would be interested to hear more if React was actually too slow for you.

(We're also working on our own optimizing compiler, but it's still a very experimental project at this stage.)

Re: Ask HN: How can we make React better?

#16
I do not have any particular request for the team. At office we love react and the journey of porting legacy to it has been enjoyable.

One thing that is somehow frustrating with multiple repositories are those shared components.

I know this is not directly an issue with react itself but after create-react-app one, two, three. ... times the amount of duplicated code/components become a huge debt.

I'm not sure I need something new/different from react@next but guidelines for creating libraries and produce high quality components (type definition done right for example) is something that I'd like to have.

Re: Ask HN: How can we make React better?

#17
post #13

At this point, I'm quite satisfied with React and use it for most of my new JavaScript UIs. A few potential improvements that come to mind: 1. More strictness in terms of what is and is not valid JSX. Just today I was working on a React Native app that compiled for iOS but not Android. The issue ended up being a stray semicolon, leading to syntactically incorrect code that allowed for a valid iOS build anyway. I woul…

Glad to hear React is working well for you!

Warning for things that aren’t errors seems like a slippery slope and one where false positives could be very annoying, but it’s an interesting request. For the specific problem of large, confusing components, we have some ideas about how to help make these more manageable that you’ll hopefully hear about soon.

React implemented in WASM is also a fun possibility but not one that we’ve started on yet. :)

Re: Ask HN: How can we make React better?

#18
post #7

Earlier quoted context omitted.

Styles. I know Facebook has an internal CSS Module thing that is not open source ready. So this has been pushed off to user land. However, lack of an officially blessed style solution makes React components less reusable across projects compared to Vue. Thanks to vue-loader, the Vue community can focus on other things. I am NOT advocating for single file components like Vue, I am hoping that FB can just bless a solut…

I agree styles are an afterthought in React. I'm starting to grow fond of Styled Components, but even then I still find doing more advanced CSS operations a bit of a pain. Things like global styles, media-queries, pseudo-selectors and nested selectors sometimes require a pretty good understanding of the library's API and almost always require a trip to the documentation. I'm really quite pleased Vue sort applied the…

[deleted]

Re: Ask HN: How can we make React better?

#19
I'm not sure if React Native (I haven't done much with React on web pages) is on topic here but I would say without any hesitation authentication.

React Native is so good and so similar to front end web work (including integrating native libraries, it was downright joyful once I figured it out) that the experience of setting up the most basic email/password authentication scheme really stood out. This is true to some extent throughout the native landscape (that it's a little more complicated than web pages), but still.

I think some might argue that this belongs in an external library, and maybe so, but I think there needs to be an easy to use standard library or framework component that keeps in mind what the developer experience is on the web.

React Native is still my first choice for a small-medium native app project, a good authentication story would put it on another level. Also note the last time this came up for me was a year ago so maybe there has been improvement.

Re: Ask HN: How can we make React better?

#20
post #13

At this point, I'm quite satisfied with React and use it for most of my new JavaScript UIs. A few potential improvements that come to mind: 1. More strictness in terms of what is and is not valid JSX. Just today I was working on a React Native app that compiled for iOS but not Android. The issue ended up being a stray semicolon, leading to syntactically incorrect code that allowed for a valid iOS build anyway. I woul…

Lin Clark did a talk last year where she discussed how React could _theoretically_ make use of WebAssembly, and how much benefit there was likely to be:

https://www.youtube.com/watch?v=3GHJ4cbxsVQ

Post reply on HN