question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrate all components to use hooks

See original GitHub issue

Two things that need to do this:

  • Migrate all components to hooks
  • ESLint plugin: yarn add eslint-plugin-react-hooks --dev. ESlint extend the defaults ("plugin:react-hooks/recommended"). Update the config in erb’s eslint config.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
reZachcommented, Jun 6, 2020

@ivanjeremic They are supporting both, yes. I just want to echo a comment by a user in the HackerNews thread:

Hooks have unlocked so much power in React but still deserve critiquing. However I think the author only hinted at the major complaint I have about hooks, which is that it’s no longer Javascript. It’s not a function, it’s sort of like type system magic. Hooks can’t be nested, order matters, can’t be conditionally called, and you have to understand trickier memoization to avoid bugs. It also isn’t portable knowledge to other systems, like vanilla Javascript is. React is great because it’s vanilla Javascript, expressions all the way down, and lifecycle methods, which everyone is used to. Hooks are a new non-vanilla-javascript paradigm with special and sometimes tricky rules. Other than, there’s no reason to write React unless you’re using hooks, and I wonder what the next major paradigm shift will be. I look back on all our HOCs and function as children and shudder compared to how easy it is with hooks.

Not that you haven’t researched it yourself, I’m just thinking that these are subtle things the framework will need to understand for this template. Hooks in general can confuse beginners in general and are not transferable knowledge, but this is simply preference I just wanted to share in case you didn’t consider before.

1reaction
ivanjeremiccommented, Jun 4, 2020

@amilajack There was good discussion I read on here as well about using hooks: https://news.ycombinator.com/item?id=22995928. Just wanted to present both sides as using hooks doesn’t solve all problems.

It is the direction React moves, so I think it is smart to follow what the React team is doing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating from class components to React hooks
There we have it! We have successfully migrated a class-based component to a functional component using hooks. It is worth noting that most ......
Read more >
Hooks migration guide - Apollo GraphQL Docs
The new hooks API for Apollo Client is a simpler way to fetch data in your React app without the boilerplate of render...
Read more >
Migrating React class components to use hooks - YouTube
Key moments. View all · Key moments · Description · Key moments. View all · Comments · Transcript ...
Read more >
React Hooks Migration - Robin Wieruch
This tutorial shows a migration path on how to write React Class Components as React Function Components with React Hooks. Therefore we will...
Read more >
Introducing Hooks - React
Crucially, Hooks work side-by-side with existing code so you can adopt them gradually. There is no rush to migrate to Hooks. We recommend...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found