News for hackers. Stuff that matters.
Re:React is becoming a black box by ritchiea on Thursday September 03, 2020 @08:49AM (#24363485)
This is the kind of post that suffers from lack of specific examples. I would love to see an interesting discussion of how hooks are not in line with most developers mental model of React and what problems it's causing (if that is indeed true, or at least true in the eyes of the author). But this post is far too generic to illuminate what the real problems are or convince me that there are any.
Re:React is becoming a black box by Exinferis on Thursday September 03, 2020 @09:01AM (#24363597)
Although the article is too generic, or not detailed enough regarding examples of what he states, I have to agree with what he is trying to say. React hooks are a mess, or at least code based around it tends to be. We have had our share of hooks based applications and they've become unmaintainable when reaching a certain size and I am glad that we are back to class based components wherever we can. In may opinion this comes down to the fact - as he states - that the mental model (what will happen, when I do this) is not simple to grasp, thus not predictable for many people.
Re:React is becoming a black box by wokwokwok on Thursday September 03, 2020 @09:57AM (#24364082)
You realize you've just done exactly what the parent complained about right?

- said it was bad

- not provided any concrete details

> they've become unmaintainable when reaching a certain size

How?

Did you start getting lot of hard to replicate bugs?

Did you find authoring new components was made difficult by your heavy use of custom hooks that were actually not as generic as you thought when you wrote them?

Did you find 3rd-party hooks had bugs?

Did you find that useRef doesn't work like you think it does, and you can't mix and match useRef and useEffect? (ouch)

What kind components are you writing that you find hooks are such a bad fit for?

Be specific.

(I'm not saying hooks are perfect; I've had all of the issues I listed happen to me, but it's still quicker to implement new features on a medium sized web app using hooks than with components in my experience; I work on 3 apps, and only one of them still uses components, and it's the most annoying to make changes too, simply because for simple business components & forms, hooks seem to reduce the amount of boiler plate, and flat out, reduce the lines of code; less code -> faster changes. It's not always that simple (see bugs comment above), but mostly... it is, in my experience: ...HOWEVER, what you've done is just wave your hands vaguely and fail to actually say anything except you don't like hooks)

Re:React is becoming a black box by bpicolo on Thursday September 03, 2020 @10:16AM (#24364267)
A mental model being complex to grasp is concrete. Complexity is one of the biggest challenges in software.

One of my favorite papers on it: https://github.com/papers-we-love/papers-we-love/blob/master...

Re:React is becoming a black box by wokwokwok on Thursday September 03, 2020 @10:28AM (#24364397)
You don't need to understand all the stuff you use.

How complex it is is not relevant unless it has a tangible impact.

eg. I use spark a lot. I don't really deeply understand how the DAG is translated into a distributed computation and the results are aggregated from the cluster.

It calculates things. It's fast. Sometimes I'm surprised by things that are slower than I expect. Oh well. Don't do lots of column renames. /shrug

It's a tradeoff.

Is the effort to understand the detail worth the benefit of doing so? Does not understanding it cause enough pain that it become prohibitive to develop using it?

Is it for spark? No. I really don't care how it's implemented. I don't even know scala. It works fine.

Is it for assembly? No. I don't care at all how my code is JIT'd to assembly / code. It just works.

It it for react hooks? I honestly haven't personally found it to be... but I don't write custom hooks much.

So, your experience with hooks might be different, and you may find the trade-off is more expensive if your case, because it tangibly causes, eg. bugs when you write your code.

...but you are quite wrong if you think that not understanding how something works is a fundamental obstacle to using it.

That is categorically false.

I would argue that it's far from proven that using complex systems necessarily causes the complexity of your system to balloon out of control... or that there is even a strong casual relationship between "mental model being complex to grasp" and the resulting complexity of the system.

Re:React is becoming a black box by crispyambulance on Thursday September 03, 2020 @10:58AM (#24364654)

  > ...it's far from proven that using complex systems necessarily causes the complexity of your system to balloon...
I don't know what "proven" would actually mean in this context, but there's a notion called "leaky abstraction". It bites you hard when you use a "do-everything" framework and something goes wrong.

All of sudden, the magic stops and you have to deal with a ream of obtuse stack traces, problems that completely smash your metal model of what's going on, and you end up in deep rabbit holes of stuff you don't want to get into at the worst possible time. That is a fundamental obstacle.

Re:React is becoming a black box by briantakita on Thursday September 03, 2020 @11:06AM (#24364741)
All things given, I'd rather use a tool that does not have leaky abstractions and if I need to investigate the inner workings of an abstraction, I can form a mental model of that abstraction with little effort. To your point, you don't need to understand the inner workings of your tools, but being able to quickly learn about the inner workings of the tools is beneficial to creating abstractions, crafting solutions, fixing issues, performing refactoring, tracking the usage of concepts across the codebase, etc.
Re:React is becoming a black box by bpicolo on Thursday September 03, 2020 @10:49AM (#24364568)
The mental model of usage is the problem, not the mental model of its internals.
Re:React is becoming a black box by wokwokwok on Thursday September 03, 2020 @11:03AM (#24364703)
no, its not.

Thats the point: the mental model is irrelevant unless it causes bugs when you use it wrong.

Does it? Does it actually cause bugs?

Not, “in general”; You’re just doing the same thing again here and doing vague hand waving. What actual bugs? What types of bugs?

Be specific

(yes, it does cause bugs, but see how this conversation is pointless when you don’t provide any details? Right, now go read the first post in this thread.)

Re:React is becoming a black box by alfonsodev on Thursday September 03, 2020 @09:11AM (#24363675)
> React hooks are a mess, or at least code based around it tends to be.

I've read a lot warnings about the pitfalls, and about hooks not doing what you think they are doing, but honestly, I haven't experience any of that, maybe because my use cases are so close to the documented ones, that I don't need to stretch the concept, and it just works as intended for me.

Could it be, that as with many other programming patterns, some developers are using it as a silver bullet, and trying to solve everything with hooks?

Otherwise I'm failing to understand, it would be useful to see examples as the mentioned above.

Re:React is becoming a black box by dkarl on Thursday September 03, 2020 @02:06PM (#24366825)
I am mostly a spectator in this argument, since I'm holding out as long as possible on committing to hooks, but the impression I got from the React Hooks FAQ is that hooks are supposed to be a silver bullet:

> Should I use Hooks, classes, or a mix of both? [0]

> When you’re ready, we’d encourage you to start trying Hooks in new components you write. [snip]

> Do Hooks cover all use cases for classes? [1]

> Our goal is for Hooks to cover all use cases for classes as soon as possible. [snip]

The answer about higher-order components is a little more nuanced but does say hooks should replace most of them:

> Do Hooks replace render props and higher-order components? [2]

> Often, render props and higher-order components render only a single child. We think Hooks are a simpler way to serve this use case. There is still a place for both patterns (for example, a virtual scroller component might have a renderItem prop, or a visual container component might have its own DOM structure). But in most cases, Hooks will be sufficient and can help reduce nesting in your tree.

Learning enough about the React lifecycle to make simple apps was a big task, but it felt like a bounded one for my purposes. Learnings hooks seems... strangely open-ended. There's a small set of built-in hooks that do certain things, and if I need more I'm supposed to build new hooks out of the old ones, and that's supposed to be it. Except that it isn't, because if that's all there was to it, people wouldn't be having difficulty. I just wish the rest of the story was sketched out and bounded for me in some way so I could know what I was getting into.

  [0] https://reactjs.org/docs/hooks-faq.html#should-i-use-hooks-classes-or-a-mix-of-both
  [1] https://reactjs.org/docs/hooks-faq.html#do-hooks-cover-all-use-cases-for-classes
  [2] https://reactjs.org/docs/hooks-faq.html#do-hooks-replace-render-props-and-higher-order-components
Re:React is becoming a black box by alfonsodev on Friday September 04, 2020 @05:00AM (#24373131)
> people wouldn't be having difficulty.

I remember people having difficulty with callbacks, then with generators, then with promises, Obersavables... you get the point. There is always something new that tries to make 80% of the cases trivial with a new elegant syntax that hides a lot of complexity, and comes with that 20% of cases where it is harder to grasp.

Re:React is becoming a black box by emerongi on Thursday September 03, 2020 @09:31AM (#24363840)
Hooks are a bit of a double-edged sword in my opinion.

On the one hand, they are nicely composable. You can make one hook call depend on another and you can easily build a lot of cool functionality thanks to this. On the other hand, you are no longer able to directly follow the flow of the code. Making a change to a series of hook calls can sometimes be scary to me as it can be hard to fully understand the cause-and-effect of that change.

On the one hand, you can hide a lot of complexity behind a simple `useSomething()` call, on the other hand the code inside `useSomething()` can be absolute horror, because all the stateful logic is handled through hooks. Any non-obvious use-case ends up being a mess of hook calls. If you only write the code once and never need to touch it again, `useSomething()` can be an amazing hook though. There are some hooks that I have written that I hope I (or anyone else) don't ever have to touch. I might just be a bad programmer though, or missing some obvious patterns.

TLDR: hooks work well, but they have downsides in terms of maintenance burden

Re:React is becoming a black box by ssijak on Thursday September 03, 2020 @10:42AM (#24364518)
On the other end you can compose class components which have lifecycle methods which you need to jump through up and down the code to figure out the full behavior. Which to me is much more unreadable than hooks and effects. Not to mention that lifecycle methods have their own gotchas.
Re:React is becoming a black box by madeofpalk on Thursday September 03, 2020 @02:32PM (#24367173)
> On the other hand, you are no longer able to directly follow the flow of the code.

Hooks are, at least as they're presented on the surface level, exceptionally functional, so shouldnt it be easier to directly follow the code? Just follow the function calls?

Re:React is becoming a black box by sydd on Thursday September 03, 2020 @10:52AM (#24364596)
> There are some hooks that I have written that I hope I (or anyone else) don't ever have to touch.

If you need to make such statements something is very wrong. Either your code or with the design patterns you're forced into by your framework/library

Re:React is becoming a black box by laurent123456 on Thursday September 03, 2020 @11:40AM (#24365092)
My experience has been the exact opposite. Class-based components encourage creating large monolithic classes because it's hard to split class methods into smaller units.

With hooks however, you can create self-contained custom hooks that group all the code of a feature in one separate file. It's much easier to test and to make sense of. It's also easier to make the hook more generic and re-usable when it becomes needed by other components.

I'm definitely not going back to class-based components as I find React hooks a lot easier to manage and maintain.

Re:React is becoming a black box by Emanation on Thursday September 03, 2020 @10:42AM (#24364522)
How is the mental model hard to grasp? Hooks are just functional components. They render information like everything else. Following the same rule set. State change? The hooks renders. Parent renders? The hook renders. Want to stop it from rendering? Use a memo. Want to run logic only when certain state changes? Use an effect.
Re:React is becoming a black box by cwhiz on Friday September 04, 2020 @12:08PM (#24376221)
I’ve had the exact opposite experience. I loathe class components and convert to hooks whenever I can. Class components seem so bloated and enormous with anything but the most simple use cases.

Sometimes when I read these comments I feel like I am using a completely different library.

Re:React is becoming a black box by duxup on Thursday September 03, 2020 @11:18AM (#24364862)
Way too many articles like this that don't provide examples.

They'll say something and I'm wondering "what do you mean exactly..." but we don't know.

I get how folks might not want to get into the weeds on minutia or etc. But without examples it's hard not to think someone just doesn't 'get it' too.

Re:React is becoming a black box by varrock on Thursday September 03, 2020 @11:22AM (#24364895)
A trend I've been seeing on HN and Reddit alike are articles that are not in depth, but allow the users of the medium in which they are shared to have a reason to talk about something. This post probably got more attention because it was a dedicated link versus somebody asking HN if they think React is becoming a black box.

I'd much prefer the latter, but it seems that links are the way of websites such as these.

Re:React is becoming a black box by ritchiea on Thursday September 03, 2020 @03:04PM (#24367520)
The quality of posts at the top of HN has really tanked over the last 2-3 years. Falling from high quality to “programmer clickbait” like the OP here. It’s a little better if you use /classic as a path, which I understand is only calculated by upvotes from users from the first couple years of HN, before the startup boom. Occasionally /news and /classic are virtually identical making me wonder if there are a lack of active OG users and the algo falls back to default during a lack of classic participation.
Re:React is becoming a black box by ricardobeat on Thursday September 03, 2020 @09:15AM (#24363703)
Ok, quick test: can you explain in a paragraph why you cannot call a hook inside a for loop?
Re:React is becoming a black box by franciscop on Thursday September 03, 2020 @09:37AM (#24363893)
Because React keeps track of the hooks you are using by the call order, and a loop might indicate than in different rerenders it might have different lengths. You actually can do it, it's just the linter trying to avoid you shooting yourself in the foot.

In fact the linter explains exactly that in a paragraph:

> React Hook "useState" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.

https://reactjs.org/docs/hooks-rules.html

Re:React is becoming a black box by ricardobeat on Thursday September 03, 2020 @09:53AM (#24364047)
That was close :) See my replies below for a counterpoint.
Re:React is becoming a black box by j-krieger on Thursday September 03, 2020 @09:34AM (#24363865)
Yes! A hook call occurs at most once per render. For react to figure out which hook call corresponds to what state, it analyzes the call order. Because we write component render functions top down, the hook call order stays the same every time every render. Not so if we call a hook inside a loop [1].

Why would you call a hook inside a loop anyway? Hooks return callbacks and variables, which you can use inside a loop without problem.

[1]: https://reactjs.org/docs/hooks-rules.html#explanation

Re:React is becoming a black box by beirut_bootleg on Thursday September 03, 2020 @06:19PM (#24369535)
Just as you don't call this.componentDidUpdate in a loop. I'm reading through the comments and trying to figure out what mental model some have of React that causes them to just don't "get" hooks. I'm starting to think this difference in thinking did not start with hooks.
Re:React is becoming a black box by tuesdayrain on Friday September 04, 2020 @11:23PM (#24381184)
Hooks aren't always comparable to lifecycle methods. At my company every GraphQL query/mutation has a corresponding hook. There are frequently times when devs are tempted to use them, especially the mutations, in for loops.
Re:React is becoming a black box by cnity on Thursday September 03, 2020 @09:33AM (#24363858)
So easy I can explain it in a sentence: React hooks must always be called in the same order, and the same amount.

If you push me by asking "why?", I can expand that sentence by including "because each hook call is associated with an index under the hood".

This is probably the only React hook nuance you really have to understand, and it's not particularly difficult.

Re:React is becoming a black box by ricardobeat on Thursday September 03, 2020 @09:43AM (#24363950)
> This is probably the only React hook nuance you really have to understand

Absolutely not. There is the dependencies array, how it only does a strict equals check (no shallow comparison), how you need to memoize other dependencies so they don't change on every render, why it is a problem to leave it empty, why useEffect cannot strictly replace componentDidMount, why you can't put one hook inside the other, how (and which) hooks can trigger a re-render or block updates, how state is captured by the closure and what to do if you need current state, how to persist things across renders using useRef.. and probably more.

Re:React is becoming a black box by svachalek on Thursday September 03, 2020 @10:07AM (#24364174)
Most of these are also true pre-hooks, it just wasn’t as clear that they were actual concerns and most users ignored them, leading to horribly slow but still functional code. Hooks drive you to more correct usage but the consequences of misuse become more severe.
Re:React is becoming a black box by SirHound on Thursday September 03, 2020 @12:25PM (#24365658)
> There is the dependencies array, how it only does a strict equals check (no shallow comparison), how you need to memoize other dependencies so they don't change on every render

So basic memoisation?

> why you can't put one hook inside the other

Hooks inside other functions may be called at any time, how is React to know which component is calling them?

Re:React is becoming a black box by ricardobeat on Thursday September 03, 2020 @06:17PM (#24369521)
> So basic memoisation?

No. Before you just had to worry about shouldComponentUpdate and data received from the 'outside'. With hooks you need to memoize arguments to every function you call within the component - you didn't have to memoize class methods. The concerns and patterns involved are very different.

Re:React is becoming a black box by cnity on Thursday September 03, 2020 @09:45AM (#24363965)
I personally find these quite easy to comprehend, but I suppose I can see how it might be difficult.

Edit: That was snarky, I apologise.

Re:React is becoming a black box by sydd on Thursday September 03, 2020 @11:04AM (#24364712)
Something that I still don't grasp with React: 1. Your render function runs quite often, e.g. on each state change.

2. But it runs a bit differently sometimes: const [a,setA] = useState(1234); Here "a" will have the value 1234 on the first run (what is a first run? When react instantiates this component? When it mounts?) Then this same line of code will assign a different value to this same variable, because setA was called in the past. Why? How does it know that this exact local variable needs a different value?

Re:React is becoming a black box by etblg on Thursday September 03, 2020 @12:33PM (#24365757)
Short, potentially inaccurate:

Render functions are only called when a component is being rendered. React keeps track of which component is currently being rendered. When you call `useState`, React knows which component is currently being rendered and keeps track behind the scenes which state that component has.

The way it knows which value it should return for `a` ties directly in with why you need to call `useState` calls in the same order -- React basically keeps a list of the state behind the scenes, and returns the (secret behind the scenes) state in order. If you change around the order of `useState` calls, it can't use the ordering of the calls to determine which state needs to be returned.

Re:React is becoming a black box by sydd on Thursday September 03, 2020 @04:23PM (#24368468)
and what happens if I unmount and remount it? something like:

<div> {isLoggedIn ? <LogoutButton /> : abcd } </div>

and I change the value of isLoggedIn. Does the state reset? I'm not asking for a solution, just pointing out that even a 'simple' hook like useState has its small quirks.

Re:React is becoming a black box by acemarke on Thursday September 03, 2020 @04:37PM (#24368603)
It does reset, because toggling that flag will unmount the old instance of the component, and then mount a new instance.

This is the same behavior as has always existed with class components and `this.setState()`. Component-scoped state only exists as long as that specific instance of the component is mounted.

Re:React is becoming a black box by 7786655 on Thursday September 03, 2020 @12:27PM (#24365682)
1. When React mounts your component, it creates an object to contain its internal state, including the state of all hooks.

2. Before calling your render function, it stores a reference to that object in a private, global variable. (Global in the sense that there's only one per JS VM) (Javascript is single-threaded so this is perfectly safe to do).

3. Each of the built-in hooks has access to that variable, and use it to increment a number representing the current hook index and then store information in an array at the current index.

4. The next time your component is rendered, that information is still there and the hooks can retrieve it.

5. Also some hooks like useEffect set up functions to be called by react later.

Re:React is becoming a black box by rashkov on Thursday September 03, 2020 @03:56PM (#24368143)
This would make for an interesting exercise.

  const React = /* Implement this */
  
  function HelloComponent(){
    const [myNumber, setMyNumber] = React.useState(0);
    // Simulate rendering data to a screen
    console.log("My number:", myNumber);
    // Simulate rendering a clickable button
    const click = ()=> setMyNumber((num)=> num + 1);
    return click; 
  }
  
  React.mount(HelloComponent); // prints 0
  React.simulateClick(HelloComponent); // prints 1
  React.simulateClick(HelloComponent); // prints 2
  React.simulateClick(HelloComponent); // prints 3
General idea being that the React item may be stateful, but the HelloComponent must be a stateless pure function. How can it draw on React's statefulness, while only using that useState() call?

I am working through this exercise now, but I'm already finding myself doing some pretty hacky things to make this work (like finding out who called a function using arguments.callee.caller.name). Still, it's pretty interesting.

Edit: My solution to this: https://gist.github.com/rashkov/f765917d09ebd629f385c21195f4...

Re:React is becoming a black box by AgentME on Thursday September 03, 2020 @06:50PM (#24369744)
Checking the function's caller breaks the composability of hooks: it stops hooks from being called by other hooks. (Also, it doesn't work in strict mode, which is enforced when you use ES modules.) React is the only thing that calls component functions, so React can just remember what component is being called before it calls it. I've posted a reply on your gist with an example that addresses this.
Re:React is becoming a black box by rashkov on Thursday September 03, 2020 @07:11PM (#24369887)
Very cool! appreciate the response, very interesting to see an improved solution on this.

I was mainly interested in solving for how React lines up the useState calls with the actual data that it's keeping under the hood. So I definitely cheesed through the parts touching on how React keeps track of the component tree. I'm enjoying reading through your interpretation of this though. Thanks

Re:React is becoming a black box by ricardobeat on Thursday September 03, 2020 @09:39AM (#24363913)
Which means you can call it inside a for loop if you have guarantees that the order will always be the same. These are the caveats that don't fit in one paragraph. Also, repeating the rule 'it has to be called in the same order' is not explaining how it works.
Re:React is becoming a black box by cnity on Thursday September 03, 2020 @09:43AM (#24363949)
What makes the fact that each hook call needs to be associated with an index so unacceptable?
Re:React is becoming a black box by ricardobeat on Thursday September 03, 2020 @09:47AM (#24363980)
You could say each call corresponds to a timestamp and they need to be ordered, and the person receiving that information would be none the wiser. It just doesn't lead you to understand what's happening underneath. Some may be fine with stopping at that level of understanding, but the stack-based approach of hooks is quite unnatural for JS and I don't think it is good in the long-term for developers to just 'accept' that as supernatural.
Re:React is becoming a black box by cnity on Thursday September 03, 2020 @09:51AM (#24364013)
So in order to understand not only the basics of the rule, but also the underlying implementation and exactly in what way it would crash, it may require more than a paragraph. I'll concede that. But this is common in programming. As an example, you'd probably spend some time understanding exactly why it is you can't free a pointer twice in C.

There's nothing stopping someone from reading the explanation in the React docs[0] if they want to understand.

[0] https://reactjs.org/docs/hooks-rules.html#explanation

Re:React is becoming a black box by daliusd on Thursday September 03, 2020 @03:52PM (#24368098)
I can give example. Svelte has actions (here details https://svelte.dev/tutorial/actions). You can take pannable action as a starting point from that page. Now try to write React hook that does the same as pannable Svelte action. You can do it. There are "problems" however:

1) React solution will need a little bit more lines;

2) There are multiple ways to write that and some ways are less efficient than others;

3) React solution is harder to write if you only started with hooks.

I'm going to use React because:

1) I don't need to learn anything new (only hooks) to do what I need;

2) I have richer environment: typescript, testing libraries and all React libraries/solutions I might need. Svelte is getting better and potentially it already covers things I need but that was not the case one year ago.

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.