Dima
Dima

Reputation: 554

Understanding unusable documentation of reactJS

I needed to get scroll position of div, so I found onScroll event in react documentation, use it in my code and in developer tool found properties that I needed. In documentation I found some words:

Event names:

onScroll

Properties:

number detail
DOMAbstractView view

Many times I come across a situation when I do not understand why something is written in the documentation and how to use it. Could someone help me and explain what this documentation is saying?

Upvotes: 0

Views: 184

Answers (1)

Matthew Herbst
Matthew Herbst

Reputation: 32053

What the documentation is saying is that if you capture the onScroll event, that event object will have at least two properties, including detail and view. For example, this means that you can do:

function onScrollHandler(event) {
  console.log(event);
  console.log(event.detail);
  console.log(event.view);
}

Specifically, detail will be of type number and view will be of type DOMAbstractView

Upvotes: 2

Related Questions