Hacker News new | ask | show | jobs
by karmakaze 2709 days ago
The 'type'ing with PropTypes which required much typing. Also having to edit 4 or more places to add one thing. Let's see there's where the UI calls the action, the action, the api request, the reducer and finally the render of the data along with any new proptypes you introduced copied to each consumer.

I imagine it could be better with a different state management library or maybe ReactReason or TypeScript. The other thing I really like about Vue is how the layout and logic stay separated. With React and JSX there's always code all over the place: class methods, regular methods, lambdas, inline '&&' throughout the JSX. The way Vue handles events is far simpler.

I do however see the value in all of this with React when working on a large team. It all adds up to safety. I haven't yet worked on a Vue app that has grown complex enough to feel any of that necessary as where even a simple React app's structure is already complex.

1 comments

PropTypes aren't required. Also, the "action" stuff is about Redux, not React.

For Redux specifically, we've got a new `redux-starter-kit` package available. It helps simplify several common use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state without writing any action types or action creators by hand. I'd encourage anyone using Redux to try it out and let us know how much it helps you.

https://redux-starter-kit.js.org

Whenever I read the source for React apps, I see a lot of machinery that varies depending on library choices, PropTypes and Redux are just examples. With Vue apps more of the source appears like things for the application and not the machinery. I also greatly value the separation of <template>, code, and style but still kept in a single file per component. All of this may be possible with React, but with Vue it's the default.