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 to Functional components and hooks

See original GitHub issue

Task

With version 4.x having a minimum dependency on React 16.8 we can now rewrite all of the module code to take full advantage of Hooks and simplify the internal code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
panz3rcommented, Jun 24, 2020

Hi @max-carroll ,

I’d go with destructuring in the initial declaration to have all the props always available and to keep the definitions clearer.

👍

1reaction
max-carrollcommented, Jun 24, 2020

@panz3r , in PreviewList we destructure all the props together in the declaration of the function, however in other places we do it as and when they are required, I assumed we wanted to go the way of destructuring the props in the declaration, but just thought I would double check before I create pull request

  • destructuring props in function brackets, e.g. const myComponent = ({all, of, the, props})
  • destructuring as and when props or required like this const myComponent = (props) => and then later on const {subset, of, props} = props
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Convert React Class Components to Functional ...
In this post, you'll explore five ways to convert React class components to functional components using React Hooks.
Read more >
Migrating from class components to React hooks
Hooks provide an interface for creating powerful functional components. They can be used to introduce state and manage side-effects.
Read more >
Migrate a React Class Component to a Function ... - Egghead.io
In this lesson we convert the class-based CurrencyCodePicker component to a function component. To do so we employ the following strategy:.
Read more >
React: Migrating from Class to Functional Components (with ...
Using hooks provides several advantages: Simplified state, simplified life-cycle control, and ease of customization. Simplified State. The ...
Read more >
Introducing Hooks - React
To solve this, Hooks let you split one component into smaller functions based on what pieces are related (such as setting up a...
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