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.

I have a throttled onResize handler. I found that unless I wrap in a useCallback, the throttling doesn’t take effect because the resize handler triggers a dimension change, which triggers a rerender, which replaces the onResize handler with a new one (starting a fresh throttle timer).

However, moving out the onResize handler means I lose out on some type inference. I don’t love copying over types and would prefer to import them. Looks like this library declares types but doesn’t export them, so I can’t use them directly.

image image

Here’s my current workaround: image

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
holiccommented, Nov 22, 2022

I just missed that there was an example for throttling, just went straight to implementing it myself.

0reactions
ZeeCodercommented, Nov 22, 2022

Nice, one last question @holic if you had time: did you not find the throttle example in the docs, or did you just not think to check them at all? I’m just wondering if there’s anything I could improve on the docs in your opinion to maybe better surface examples like these?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Modules - TypeScript
The export = syntax specifies a single object that is exported from the module. This can be a class, interface, namespace, function, or...
Read more >
How to export a Type in TypeScript | bobbyhadz
Use a named export to export a type in TypeScript, e.g. export type Person = {} . The exported type can be imported...
Read more >
What is `export type` in Typescript? - javascript - Stack Overflow
This is a type alias - it's used to give another name to a type. In your example, feline will be the type...
Read more >
Typescript Types indirect re-export with isolatedModules: true
Typescript Types indirect re-export with isolatedModules: true - index.ts.
Read more >
Exporting Imported TypeScript Types - Ship Shape
We logically kept our types in separate files, i.e. the types for tour.jsx lived in tour.d.ts etc. This was great, and we thought...
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