DEV Community

Egbert Nierop
Egbert Nierop

Posted on

Weird behavior on passing data within

*** Does anybody have an idea why {index} in the Redirect is being always the last item of the items array????
I am bumping my head against the wall for this. It should work?! Thanks.
NOTE: Code removed for brevity.

interface IRedirect {

cat: number;

slideId: number;
}

const Redirect = (props: IRedirect) => {
let hist = useHistory();
return (
{

        const pass = `/newsdetail/${props.cat}/${props.slideId}`; *<------------ ALWAYS the same number, not the index*

        hist.push(pass);

    }} className="readmore">Read more ....
    </Link>)
Enter fullscreen mode Exit fullscreen mode

}

export class NewsCarrousel extends Component
{
render() {
return ( return ( {
items.map((m, index) => {
return (

            <Redirect cat={NewsCarrousel.curCategory} *slideId={index}/>*
Enter fullscreen mode Exit fullscreen mode

}

Top comments (1)

Collapse
 
egbertn profile image
Egbert Nierop

It was slick carrousel. Adding a z-index: 10 to current-slide the correct panel now is being clicked. It look like we had a weird javascript 'closure' issue.

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more