Live data from Hacker News

Ask HN: How can we make React better?

news.ycombinator.com

51–60 of 68 posts

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

#51
post #47

bring back 2-way binding. There are use cases, where it greatly improves productivity. Leave the choice about it to the developer.

I wonder if this could be solved with a general jsx decorators feature? For example: ...where bind is a normal function in scope that receives the element and/or its props?

there are various ways to put this into a syntax. one way would be to have a dedicated attribute that behaves this way for relevant components. This would then be similar to the vue.js approach https://vuejs.org/v2/guide/forms.html

or

At least for standard HTML components this should work, as they would only have one editable property.

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

#54
Extract jsx into a separate template language not some halfways js compatible cludge. I don’t write php for a reason.

Deal with state better, currently if you have anything more than a list of todos, react grinds to a halt. It’s completely unable to deal with a realistic amount of state. Side note: this is really weird since react is very fond of state. I’ve tried redux and it just makes everything worse by adding in more checks that can only handle identity checks with any sort of efficiency.

Lastly react prevents me using a lot of existing js because it interferes with the lifecycle in react, or manipulates the dom directly. This makes working with react much less efficient than writing plain js.

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

#56
post #27
post #22

Maybe this is either an uncommon use case or I'm missing an easy way to do it, but when you have a component tree like A->B->C (-> denoting child relation) and A contains most of the state and B contains many (say > 1k) children, and you keep updating state in A which only affects one or a few of C, the diffing process as I understand will check all of C whether they need to be rerendered. So if you update the state…

Forgive me if I misunderstand the problem, but is it not sufficient to implement a fast shouldComponentUpdate on C, ideally making C a pure component? The render pass will still do a check for every C whenever B updates, but I would think that strict equality checks would usually be fast enough even for thousands of components every animation frame. If that’s not fast enough, perhaps it would be faster to directly su…

Thank you and @hfourm, I will try out the redux solutions proposed.

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

#57
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.)

I don't trust facebook period.

they can still relicense it in the future if they manage to kill off their competition. At that point I'd have to hope that someone will fork a pre license change version. Don't want to risk dealing with that crap don't want to support facebook.

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

#58

I kinda enjoy working with React (because of JSX simplicity and composability). I think you could add easy support for some styling solution like it's done in Vue. I would focus on making React stable, fast and lightweight but improve on tooling and ecosystem around it. * I would like blessed way of extracting React components, so they can be reused between projects (like right click in IDE and share) - something lik…

+1 for typescript support. This helps in reducing compile/build time errors and for the devs who are from java/c# background.

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

#59
More documentation around the effect of specifying / not specifying key prop would be extremely useful to ensure people understand how it affects lifecycle methods.

In fact more documentation around practical patterns would be useful.

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

#60
Disclaimer: I don't write much ui code. Random ideas:

-Simple constraint thing for when ui code+network latency+button mashing people fuse together in an explosion of corner cases.

-Frontend analyzer thing that tells you interesting things about your app.

-Make the declarative concept even more prominent w/code totally removed from the component in normal use case scenarios. Then the fancy tool explains how events & coroutines and so on interact. So swapping component libs becomes trivial.

Post reply on HN