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.

Add react hooks support

See original GitHub issue

Hi! Thank you for your package

I’m wondering, are there any plans to support React hooks? Something like

const {width, height} = useResizeDetector(ref);

I believe it can be useful nowadays

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
maslianokcommented, Nov 25, 2020

Great push, @LosYear 😃

I also think it will be a good feature for the library. I’ll try to work on it this month

2reactions
stefann01commented, Jan 14, 2021

Typescript support? Setting ref={ref} in typescripts it says that

Type ‘MutableRefObject<Element | undefined>’ is not assignable to type ‘string | ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined’. Type ‘MutableRefObject<Element | undefined>’ is not assignable to type ‘RefObject<HTMLDivElement>’. Types of property ‘current’ are incompatible. Type ‘Element | undefined’ is not assignable to type ‘HTMLDivElement | null’. Type ‘undefined’ is not assignable to type ‘HTMLDivElement | null’.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing Hooks - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. ... This...
Read more >
Hooks at a Glance - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. Hooks are...
Read more >
React v16.8: The One With Hooks
React Hooks are now supported by React DevTools. They are also supported in the latest Flow and TypeScript definitions for React.
Read more >
Building Your Own Hooks - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. Building your...
Read more >
Hooks FAQ - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This page...
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