React-slick: customArrow meet a problem

Created on 6 Aug 2018  路  3Comments  路  Source: akiran/react-slick

use this:
var settings = {
dots: false,
infinite: true,
speed: 500,
slidesToShow: 6,
slidesToScroll: 1,
nextArrow: ,
prevArrow:
};
get this:
Warning: React does not recognize the currentSlide prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase currentslide instead. If you accidentally passed it from a parent component, remove it from the DOM element.
React does not recognize the slideCount prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase slidecount instead. If you accidentally passed it from a parent component, remove it from the DOM element.

That's not a big problem, but hope to solve.thanks

stale

Most helpful comment

It would be more helpful to have a JSFiddle or CodePen to demo your issue.

Here's an example of using a custom arrow where you have access to currentSlideand slideCount.

In your settings:

nextArrow: <NextArrow />,

Your arrow function:

// Next arrow
function NextArrow(props) {
   const {currentSlide, slideCount, className, onClick} = props;

   return (
      <div onClick={onClick}>
         <button className={"slick-arrow slick-next"} />
      </div>
   );

All 3 comments

It would be more helpful to have a JSFiddle or CodePen to demo your issue.

Here's an example of using a custom arrow where you have access to currentSlideand slideCount.

In your settings:

nextArrow: <NextArrow />,

Your arrow function:

// Next arrow
function NextArrow(props) {
   const {currentSlide, slideCount, className, onClick} = props;

   return (
      <div onClick={onClick}>
         <button className={"slick-arrow slick-next"} />
      </div>
   );

@walker-jiang, only components are allowed to be a custom arrow. You can't provide plain JSX tags to prevArrow and nextArrow props.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adamthewan picture adamthewan  路  4Comments

briziel picture briziel  路  3Comments

rohitgoyal7 picture rohitgoyal7  路  3Comments

darkalor picture darkalor  路  4Comments

laveesingh picture laveesingh  路  3Comments