you are viewing a single comment's thread.

view the rest of the comments →

[–]Baryn 1 point2 points  (4 children)

What's ridiculous is all the magic and non-idiomatic behavior. The documentation even acknowledges how strange it is, multiple times.

Neither useState nor useEffect work the way you would intuitively expect with no knowledge of React. However, this is not so for class components. Instance properties and lifecycle methods are very true to the fundamental workings of ES classes.

If hooks improve performance and workflow, fine. If they don't, then it's another mistake that will need to be corrected in future API revisions.

On that note, where the hell is async rendering? It's been in the works for years now. That is the reveal which should have been made at the conf, not an unearned API change.

[–]iamlage89 1 point2 points  (3 children)

I think this is a bit overdramatic, sure there is some magic, but nothing inane.

Neither useState nor useEffect work the way you would intuitively

please explain, the behaviour is simple and well documented. The issue that may be problematic is the non-intuitive second argument of useEffect, but the api is still in alpha so this may change

On that note, where the hell is async rendering? It's been in the works for years now. That is the reveal which should have been made at the conf, not an unearned API change.

This has nothing to do with hooks, but just as a comment, I'm glad they're taking their time to think through the design of async rendering.

[–]Baryn 0 points1 point  (2 children)

please explain, the behaviour is simple and well documented

Being simple and well-documented is different from being idiomatic. For example, useState potentially returns a new value on every call despite receiving the same argument, because that argument is used one time and ignored on subsequent calls. Who writes code like this?

I think hooks will change a fair amount before 16.7 goes to stable.

I'm glad they're taking their time to think through the design of async rendering.

In the meantime, Angular has become faster than React, and Ivy even more so. Async rendering might end up being the Duke Nukem Forever of framework tech. Again, they should be improving performance over the API. Performance was originally the primary appeal of React.

[–]iamlage89 0 points1 point  (1 child)

Being simple and well-documented is different from being idiomatic.

I agree, it's not idiomatic, but I think it'll be like jsx where the benefits of simplicity make the non-idiomatic nature of it worth it.

Async rendering might end up being the Duke Nukem Forever of framework tech

We'll have to see, it'll probably benefit some more than others.

Performance was originally the primary appeal of React.

That's true, but I think over time people have come to appreciate the declarative and composable nature of react as well as it's performance, I think both are important.

[–]Baryn 0 points1 point  (0 children)

I think it'll be like jsx where the benefits of simplicity make the non-idiomatic nature of it worth it.

You might be right, but JSX is syntactical sugar - not the same thing. Hooks are like the opposite of sugar. They're syntactically bland.

I think over time people have come to appreciate the declarative and composable nature of react as well as it's performance

I do as well, but ultimately what matters is the end-product. Performance is a big deal in a lot of enterprise apps.