Live data from Hacker News

React Makes You Sad?

github.com

71–80 of 211 posts

Re: React Makes You Sad?

#71
post #36

As a C and then a Ruby on Rails programmer, I never thought I would see the day that my main programming language was Javascript. But I find React such an enabling technology that I made the effort to learn Javascript properly, and am glad that I did. React itself is allowing me to write web applications faster and with less bugs, primarily because of the unidirectional information flow, but also because of the way i…

I just want to point out that there is no mandate to use a framework in JavaScript. While I'm not familiar with React and I agree that it probably helps developers structure their apps, there is no need to use a framework just to have a component/modular architecture.

One of my favorite examples of clean modular JS that does not depend on a framework is Mozilla's browserquest: https://github.com/mozilla/BrowserQuest/tree/master/client/j...

Many things that make life easier when making relatively small web apps also make debugging more complicated, compared to programming from scratch with minimal reliance on third parties. Choose wisely.

Re: React Makes You Sad?

#72
post #28

Earlier quoted context omitted.

What were you doing?

Writing a 'driver' to integrate my low level UI component library to be usable with React. My major issue was the 'rule' that a parent can't access the 'state' of it's children; this turned a 2 hour job into a 3 day job for me just trying to find a way to get access to this state through all of the lifecycle callbacks while instantiating children at the same time. When asked in #reactjs, they said that if you need ac…

Put ref properties on the child components. Put public methods on the child components. You can then access the refs from the parent in the parent's componentDidMount or componentDidUpdate methods.

Re: React Makes You Sad?

#73
This flowchart assumes you are writing in javascript. Perhaps this is understandable as it's a javascript library, but there are several frameworks for other languages (most notably Om/Clojurescript).

Re: React Makes You Sad?

#74
post #53

Earlier quoted context omitted.

We're currently using Mithril and one of the biggest issues was getting started in it. It's adoption is lacking, making finding people who've had similar issues difficult. Solving every problem yourself is much harder than finding an existing answer on SO. That said, we still use it, but we're considering moving to React in the future, mostly since its learning curve is a lot less steep and we would be able to iterat…

While domvm [1] is young and doesn't have the adoption of Mithril (not even within an order of magnitude), it does solve many issues that people frequently have with Mithril's architecture and magic. Check it out if you'd like. Disclaimer: I'm the author and 1.0 (stable) target is April 1st. [1] https://github.com/leeoniya/domvm

You might wanna rethink that target date (April Fool's Day).

Re: React Makes You Sad?

#75
post #30

This reminds me of that Netflix talk on React [1]. In it, the guy first praises React to the heavens, then spends the rest of the session explaining all the ways they had to disable and work around React to get what they wanted with decent performance. It seemed to me like their use case could have been done with jQuery in a few hundred lines. Maybe I missed something. [1] https://www.youtube.com/watch?v=g01dGsKbXOk

Nah you got the point, all these JavaScript frameworks are just over-engineering.

Re: React Makes You Sad?

#76
post #21

Earlier quoted context omitted.

It's certainly a weird phrasing of an argument. However, it seems reasonable that some programmers will not like the specific style of structure that react espouses. Specifically the top-down push of data through parent-child component relationships. Specifically, if you are working with a lot of third party components that are not react based, it can be hard (or a lot of boilerplate) to contain them within react app…

But you certainly can NOT do that. You can write "smart" components that each talk to the necessary store(s) and make decisions. As your project grows, you'll come to see WHY small, dumb components are helpful, and how the top-down view manages the scope of rerendering. You can come around to the espoused best practices organically.

You can but fundamentally, if you dont buy into the fundamental guiding principles that a framework is based on, you probably shouldn't use the framework.

Its like saying lets use angular but not limit DOM manipulation in directives, build fat controllers that include direct requests to the server and business logic because all the service boiler plate is annoying and makes the application harder to reason about, and add objects directly to the global object because angulars dependency injection based on string values is error prone, not DRY, and kinda fool hardy, not use data binding because of the performance issues...

yeah those may be valid points, but if you buy into that you should just drop angular and use backbone or something else...

Re: React Makes You Sad?

#77
I really like React, but I have to admit, that I don't write big apps with it (yet).

There is one thing though which I find results in subtil bugs (entirely my fault): When one input is changing and depending on that input another output value has to change than the input shouldn't change state yet and the output should be computed from input (+ state where necessary). Only then you should set the state.

Do not set the state before computing the output and don't compute the output from the previous state only. This will result in subtle and sometimes hard-to-find bugs.

Re: React Makes You Sad?

#78
post #21

Earlier quoted context omitted.

It's certainly a weird phrasing of an argument. However, it seems reasonable that some programmers will not like the specific style of structure that react espouses. Specifically the top-down push of data through parent-child component relationships. Specifically, if you are working with a lot of third party components that are not react based, it can be hard (or a lot of boilerplate) to contain them within react app…

I've actually found it surprisingly easy to wrap 3rd party libraries in thin React components once you figure out the lifecycle methods and findDOMNode().

That's what I thought until I actually tried. findDOMNode was the first thing I found and then I thought it would be trivial, but the problems of passing child state up to the parent left me befuddled for days.

Re: React Makes You Sad?

#79
nice flowchart, i know the point of redux but man the boilerplate needed to create a component sucks:

  class _MyActualComponent extends React.Component{
  //my component's implementation goes here.
  }

  /** type for casting (so consumers know the props they are required to pass */
  class IMyComponentVisibleType extends React.Component { };

  /** instrument my component with redux */
  export var MyComponent = ReactRedux.connect(
  (reduxStoreState) => { //subscripbe to reduxStore updates (Called every change). 
      return { myReduxState: reduxStoreState.myReduxState }; //map myReduxState to props
  }
  , _.merge({}, {}, { pushPath: ReduxSimpleRouter.pushPath }, reduxScafolding.action) as any  //redux-binds, then includes the pushPath() method for use in our _App Component
  )(_MyActualComponent) as any as typeof IMyComponentVisibleType;
ps: yes, about 3 lines of that is because I use Typescript.

Re: React Makes You Sad?

#80

React made me sad, so I switched to Mithril[1]. Not only is it significantly smaller in size, but it's way faster and includes a router and AJAX methods out of the box. I wish more people would give it a shot. That said, I do still love React Native, and use React on a daily basis to take advantage of the "write once, run anywhere" paradigm. [1] https://lhorie.github.io/mithril/

Project seems abandoned, no?

Other correct comments about a quite active 'next' branch aside... The latest commit on master is Nov 12, 2015. That's not even half a year ago. The stable shelf life of software worth mentioning is longer than that, don't you think?
Post reply on HN