Because of this line https://github.com/akiran/react-slick/blob/master/src/arrows.js#L35 I get errors with React 16.

What is the purpose of this? How it will help with a config like this:
nextArrow: (
<span>
<IconButton>
<FA icon={faChevronRight} />
</IconButton>
</span>
),
Don't pass down all the props that you receive for custom arrows.
nextArrow: ({ firstProp, secondProps, ...otherProps }) => (
<element {...props that you want} />
)
Something like this should work.
It did not work :) I tried like this:
nextArrow: () => (<span>...</span>);
The problem is that lib expects nextArrow to be an Element, and it clones it. So function does not work and lead to error.
+1
Any progress?
would be great to solve this.
You may use this as workaround:
const SlickButtonFix = ({currentSlide, slideCount, children, ...props}) => (
<span {...props}>{children}</span>
);
const SETTINGS = {
prevArrow: (
<SlickButtonFix>
<IconButton>
<ChevronLeft />
</IconButton>
</SlickButtonFix>
)
};
@kirill-konshin thanks this worked well 馃憦, react-slick custom arrows help to make arrow accessibility. https://codesandbox.io/s/myqq0yz54y
<SlickButtonFix> <IconButton> <ChevronLeft /> </IconButton> </SlickButtonFix>
Thank you, man! you saved my life!
Update, needed to do the following (version 0.27.13) to avoid the default button showing up.
(add some css to hide it)
body .slick-prev::before,
body .slick-next::before {
display: none;
}
const SlickButtonFix = ({ currentSlide, slideCount, children, ...props }) => (
<span {...props}>{children}</span>
);
prevArrow={
<SlickButtonFix>
<img src="/chevron-left.svg" alt="previous quote" width="12" height="20" />
</SlickButtonFix>
}
nextArrow={
<SlickButtonFix>
<img src="/chevron-right.svg" alt="next quote" width="12" height="20" />
</SlickButtonFix>
}
@bohehe @kirill-konshin I'm running into seeing the button appear along my custom arrow with this fix, did you run into this at all?

const SlickButtonFix = ({ currentSlide, slideCount, children, ...props }) => (
<span {...props}>{children}</span>
);
prevArrow={
<SlickButtonFix>
<img src="/chevron-left.svg" alt="previous quote" width="12" height="20" />
</SlickButtonFix>
}
nextArrow={
<SlickButtonFix>
<img src="/chevron-right.svg" alt="next quote" width="12" height="20" />
</SlickButtonFix>
}
When i do the following I don't see the issue:
prevArrow={<img src="/chevron-left.svg" alt="previous quote" width="12" height="20" />}
nextArrow={<img src="/chevron-right.svg" alt="next quote" width="12" height="20" />}
Why is it closed? It's a workaround, but not the solution. Why the library is injected props directly into the function's/component's output?
Most helpful comment
You may use this as workaround: