question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change settings dynamically

See original GitHub issue

I am using React-Slick for my project and I want to be able to dynamically change the settings that I provide to my slider.

For slickjs (https://github.com/kenwheeler/slick) this can be done using slickSetOption.

I realized that it is not possible to use slickSetOption in React Slick after reading the documentation. However, after reading the following it made me think that it should be possible to in fact change the settings of the slider in a dynamic way.

slickGetOption has been implemented slickSetOption will not be implemented, those effects be achieved by passing props via state from the wrapper component

_Originally posted by @laveesingh in https://github.com/akiran/react-slick/issues/1063#issuecomment-368816567_

My implementation looks like this, and unless I am using this in a completely wrong way or have misunderstood the above statement this is probably a bug.

<Slider
	dots={true}
	infinite={true}
	speed={500}
	slidesToShow={1}
	slidesToScroll={1}
	autoplaySpeed={2000}
	autoplay={props.autoplay} // even if the value is changed, autoplay stays to it's initial setting
>
	{images}
</Slider>

Using React Slick’s playground I’ve put together this to demonstrate the issue: https://codesandbox.io/s/react-slick-playground-unyot

Sort of a dodgy work around is to add a key prop to <Slider /> and change the value of that as the props changes.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sinnercommented, Jan 28, 2021

I have the same problem with the initialSlide settings property.

1reaction
RuiGuilhermecommented, Nov 5, 2020

Same issue here;

<Slider
	{...{
		dots: false,
		accessibility: false,
		infinite: true,
		speed: 2000,
		autoplaySpeed: 5000,
		slidesToShow: 1,
		slidesToScroll: 1,
		pauseOnHover: false,
		autoplay: autoplay
	}}
>

autoplay start with true; If I change prop of autoplay to false, autoplay stop. But if set again to true autoplay don’t work. Version: 0.27.11

I don’t know if this will help but I fix it using this, fallow example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Actions to change your configuration dynamically - IBM
Defining a configuration dynamically involves the following tasks: ... Check that the current software I/O configuration definition matches the hardware I/O ...
Read more >
How to dynamically set 'settings' configuration for ... - GitHub
To change the settings dynamically, you need to assign a new object to the settings variable. Lets say you create a object mySettings:...
Read more >
Selectize : Change settings dynamically - Stack Overflow
I have successfully found a solution but its a little bit messy. selectize.settings.load = function(query, callback) { $.ajax({ url: ...
Read more >
How to manage dynamic settings in Django - Rootstrap
It can be done through code or the Django admin page, which results to be very helpful. Assuming you already have Celery integrated...
Read more >
Dynamically Modifying an Application - Oracle Help Center
1. Enter tmconfig after a shell prompt. · 2. Select the section that you want to change by entering the appropriate menu number,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found