akiran / akiran/react-slick

Is forwardRef going to be implemented ?

Ouverte
#1,821 2 commentaires 12 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
11.9k
Forks
2.1k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Currently using **Next.js** for a project, and I am trying to use the new Dynamic Import with the Slider (react-slick) component to create a separate chunk.

The problem is that I need to forward the ref to be able to use a custom Next & Prev button.
React has a new API to allow that, [forwardRef](https://reactjs.org/docs/forwarding-refs.html#forwarding-refs-to-dom-components)

**Steps to replicate :**
1 - First I need to Dynamically Import react-slick :
```jsx
const DynamicSlider = dynamic(() => import('react-slick'))
```
2 - Then use the forwardRef api :
```jsx
const ForwardedSlider = React.forwardRef((props, ref) => (

{props.children}

))
```
3 - And use ForwardedSlider :
```jsx

slider content

```

Even if my component is rendered, I can't access to the object 'myRef' and can't use my custom buttons

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.