Answer the question
In order to leave comments, you need to log in
How to use ScrollArea library methods inside a component?
There is a react-scrollbar library that has some methods (scrollYTo, scrollBottom, etc.).
The essence of the question: is it possible to use these methods in the addUser component?
...
import ScrollArea from 'react-scrollbar'
import UserList from './components/UserList'
class App extends Component {
addUser = (e) => {
//add user function
}
render() {
return (
<ScrollArea>
<UserList />
</ScrollArea>
)
}
}
...
Answer the question
In order to leave comments, you need to log in
import ScrollArea from 'react-scrollbar'
import UserList from './components/UserList'
class App extends Component {
addUser = (e) => {
this.scrollArea.scrollBottom();
}
render() {
return (
<ScrollArea ref={(ref) => this.scrollArea = ref}>
<UserList />
</ScrollArea>
)
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question