Fix slick-initialized to fire when the component finishes mounting …#256
Fix slick-initialized to fire when the component finishes mounting …#256chemoish wants to merge 1 commit intoakiran:masterfrom
slick-initialized to fire when the component finishes mounting …#256Conversation
…(Only fires on the client). This will prevent a FOUC when doing SSR.
|
Addresses #254. |
|
Works great! Hiding the component is definitely better than FOUC. Ideally I'd like to prepare the space for the carousel and show a loading indicator in there. |
|
@akiran thoughts? |
|
@chikathreesix, for me |
|
Closing this because add classes with classList.add is not a very react friendly |
|
Do you have documentation that indicates your statement is the case? In my experience this is the most performant way of managing visibility. Alternatively, you can have a Either solution is better than #288—due in part to the complexity of the solution, but also the current logic is incorrect (The slider isn't initialized until the component finishes mounting). |
|
The reason why I created #288 is, this solution hides the whole carousel so it still causes a layout change after the code runs. The logic of #288 is not complicated, it just hides non current banners. What makes it not really beautiful is handling duplicated banners placed on both left and right. In my opinion, the carousel should take another approach not to generate these backup banners but this is a different topic so I have just dealt with it in a not really beautiful way. |
…(Only fires on the client). This will prevent a FOUC when doing SSR.
NOTE: https://github.com/akiran/react-slick/blob/master/src/initial-state.js#L27 seems like dead code.