React useState update is not re-rendering component

Viewed 151

I want to re-render the child component which uses state of parent component as props.

My scenario: And using a react-slick slider to show images on a page, and it has a prop initial slide accoding which slider show initial slide. I am using useState() to maintain initialSlide value, There is another trigger on page which updates initialSlide value and when I update initialSlide value it does not re-render react-slider.

Please check demo code below: Demo

In above demo, click on button> currentSlide value updates> react-slider does not update.

Is there a way to achieve this in react, I tries same using redux store but child component never re-renders.

1 Answers
Related