Top "React-ref" questions

this.refs.something returns "undefined"

I have an element with a ref that is defined and ends up getting rendered into the page : <div …

javascript reactjs react-dom react-ref
How do we know when a React ref.current value has changed?

Normally, with props, we can write componentDidUpdate(oldProps) { if (oldProps.foo !== this.props.foo) { console.log('foo prop changed') } } in …

javascript reactjs react-ref
React-Native scroll to top with Flatlist

I'm having a lot of trouble scrolling to the top of my Flatlist so any help would be greatly appreciated! …

react-native react-native-flatlist react-ref
React Refs with TypeScript: Cannot read property 'current' of undefined

I'm building a React application using TypeScript. I want to create button, that scrolls to a header of a child …

reactjs typescript forward-reference react-ref
React: How to Animate Expanding and Collapsing Div When the Size of the Content is Not Knowable

Question: I have a React functional component that recursively renders nested lists. That part is working fine. The part that …

reactjs animation recursion react-ref react-animations
React hooks and functional component ref

const Comp1 = forwardRef((props, ref) => { useImperativeHandle(ref, () => ({ print: () => { console.log('comp1') } }), []); return <div>comp1&…

reactjs react-hooks react-ref
Using createRef in react-native with typescript?

I am trying to figure out how I need to use React.createRef() in react native with typescript as following …

reactjs typescript react-native react-ref
How to use React.forwardRef() in React Native

I am using refs for access child component <MyComponent ref='_my_refs' ... /> and call them this.refs._…

javascript reactjs react-native react-ref
React Hooks - Passing ref to child to use ScrollIntoView

I have two components. A parent and a child. Inside the parent component I have a button. If the user …

reactjs react-hooks js-scrollintoview react-ref