akiran / akiran/react-slick

Is forwardRef going to be implemented ?

オープン
#1,821 コメント 2 件 リアクション 12 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
11.9k
フォーク
2.1k
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。