_slider1Ref in a function component
See original GitHub issueHow can I access this._slider1Ref in a function component and not in a class?
<Carousel ref={c => this._slider1Ref = c} />
Issue Analytics
- State:
- Created 4 years ago
- Comments:12
Top Results From Across the Web
Using the Effect Hook - React
The Effect Hook lets you perform side effects in function components: import React, { useState, useEffect } from 'react'; function Example() { const...
Read more >Function Components - React TypeScript Cheatsheets
Function Components. These can be written as normal functions that take a props argument and return a JSX element. // Declaring type of...
Read more >React Function Components
This in-depth guide shows you everything about React Function Components -- which are basically just JavaScript Functions being React Components ...
Read more >React - How to force a function component to render?
Using react hooks, you can now call useState() in your function component. useState() will return an array of 2 things: A value, representing...
Read more >How To Convert React Class Components to Functional ...
In this tutorial, we'll look at five ways to convert React Class Components to Functional Components using React Hooks.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I use the useRef hook.
I’ve not been able to type it correctly though, it works but with warnings, I don’t know if it’s an issue with my code or the typings.
mine seems to be happy with this:
const carouselRef = useRef<Carousel<ICarouselData> & ScrollViewProps & CarouselStatic<ICarouselData>>(null);