This is a sample implementation using the
useCarousel hook as described in my article at LogRocket.
If you have Node with NPM installed you can just install the local dependencies after cloning:
then you can run the local dev server using:
This will start the dev server at localhost:1234.
The source code is contained in the
useCarousel.ts has the code mentioned in the article, while
DemoCarousel has a carousel component using this hook. This sample uses emotion for styling - so all the CSS is inlined.
app.tsx hosts the application. It creates an instance of teh
DemoCarousel component just rotating three placeholder images.
This sample code is released using the MIT license. For more information see the LICENSE file.