News for hackers. Stuff that matters.
Re:React is becoming a black box by neolefty on Thursday September 03, 2020 @08:56AM (#24363549)
Agreed.

In fact, it smells like the author doesn't know what he's talking about; in my experience "That will break for the following incredibly subtle reasons:" is usually about React fundamentals such as being deliberate with state mutations.

Custom hooks are some of the most useful and fun code to write, in my experience.

Re:React is becoming a black box by madeofpalk on Thursday September 03, 2020 @09:01AM (#24363599)
I was going to say - the main reason why I like Hooks is because it's a lot simpler to reason with compared to classes, and it makes it easier to avoid whole classes (heh) of bugs.

If anything, React is becoming less of a black box, with a 'simpler' API. It's just that in the process to moving to or learning the new API, people are understanding they didn't actually understand React before. They're now being made to confront that.

Re:React is becoming a black box by hn_throwaway_99 on Thursday September 03, 2020 @09:03AM (#24363609)
> He is the founder of Formik and co-host of The Undefined Podcast.

You can disagree with him fine, but I'm quite sure the founder of Formula knows what he's talking about when it comes to React.

Re:React is becoming a black box by dota_fanatic on Thursday September 03, 2020 @09:36AM (#24363883)
Fwiw, we have a stable admin client that uses Formik. One month, I went to update dependencies. Since the admin client was stable, I only updated its deps for minor versions. Four weeks or so later I get a bug report for that client. Nothing obvious or non-obvious jumped out at me in the component of concern and its blame. After git bisecting, it turns out the minor version bump to Formik had a breaking change.

I've only touched that package a few times since but it never fails to make me wish the original lead hadn't used Formik. I dunno, forms in react have never given me tears, but contrary to Formik's slogan it has been painful, even aside from this versioning fiasco, so I'm not sure this endorsement is as strong as you think it may be.

Re:React is becoming a black box by hn_throwaway_99 on Thursday September 03, 2020 @09:52AM (#24364032)
I'm not endorsing Formik in any way, but I don't think making an accidental breaking change in a minor version is exactly a cardinal sin.

What I'm saying is silly is to say the author is somehow "uninformed" when it comes to React like he's some sort of newbie, as opposed to the guy who wrote the library that a sizable percentage of React apps use for their form components.

Re:React is becoming a black box by j-krieger on Thursday September 03, 2020 @09:36AM (#24363880)
Formik started as a class-based library and most likely still uses some under the hood. Maybe he's just not a fan of the hook API and prefers the other way?
Re:React is becoming a black box by nkohari on Thursday September 03, 2020 @09:09AM (#24363652)
> author doesn't know what he's talking about

The author is Jared Palmer. He's a well-known engineer who has worked with React for years, and the author of a very popular OSS React library (Formik).

Re:React is becoming a black box by wulfricin on Thursday September 03, 2020 @09:24AM (#24363785)
I think he is a bias against hooks since his library(Formik) doesn't work well with Hooks with react-hook-form coming up to take its throne
Re:React is becoming a black box by KuhlMensch on Thursday September 03, 2020 @01:40PM (#24366514)
Oh, that seems conveivable.

I used Formik long before hooks, then later, after hooks. I remember hesitating a few times because some of the exceedingly neat pattern/syntaxes were impacted negatively by hooks.

I still "happy" with both, but my team is all quite senior and I feel for jnr teams trying to grapple with React AND hooks at the same time.

Re:React is becoming a black box by j-krieger on Thursday September 03, 2020 @09:37AM (#24363887)
I think you hit the hammer on the head with this one.
Re:React is becoming a black box by krnsk0 on Thursday September 03, 2020 @01:40PM (#24366504)
Can confirm that Formik's hooks API is really not very good. Any change to any form component results in the entire form rerendering when hooks are used to connect to Formik context. Lost months of time in last gig to the choice to use Formik.