mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #47086 [react-scrollspy] Fix type definitions for onUpdate prop by @hueter
This commit is contained in:
parent
cef64f0170
commit
3873cd380b
2
types/react-scrollspy/index.d.ts
vendored
2
types/react-scrollspy/index.d.ts
vendored
@ -29,7 +29,7 @@ export interface ScrollspyProps {
|
||||
rootEl?: string;
|
||||
|
||||
// Function to be executed when the active item has been updated
|
||||
onUpdate?: (item: string) => void;
|
||||
onUpdate?: (item: HTMLElement) => void;
|
||||
|
||||
// ClassName attribute to be passed to the generated <ul /> element
|
||||
className?: string;
|
||||
|
||||
@ -12,10 +12,16 @@ function TestComponent() {
|
||||
<section id="section-3">section 3</section>
|
||||
</div>
|
||||
|
||||
<Scrollspy items={items} currentClassName="is-current">
|
||||
<li><a href="#section-1">section 1</a></li>
|
||||
<li><a href="#section-2">section 2</a></li>
|
||||
<li><a href="#section-3">section 3</a></li>
|
||||
<Scrollspy items={items} currentClassName="is-current" onUpdate={el => console.log(el.id)}>
|
||||
<li>
|
||||
<a href="#section-1">section 1</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#section-2">section 2</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#section-3">section 3</a>
|
||||
</li>
|
||||
</Scrollspy>
|
||||
</div>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user