rsnext/examples/with-react-multi-carousel/README.md
Tim Neutkens 3e51ddb8af
Move syntax formatting to prettier (#7454)
* Run prettier over packages/**/*.js

* Run prettier over packages/**/*.ts

* Run prettier over examples

* Remove tslint

* Run prettier over examples

* Run prettier over all markdown files

* Run prettier over json files
2019-05-29 13:57:26 +02:00

1.2 KiB

react-multi-carousel example

Source code is hosted on the react-multi-carorusel repository.

[Demo

Usage

Install and run:

npm install
npm run dev

The idea behind the example

react-multi-carousel is a React component that provides a Carousel that renders on the server-side that supports multiple items with no external dependency.

The reason for that is i needed to implement a Carousel component for my own project, but couldn't find any that is lightweight and supports both ssr and allows me to customized.

How does it work with ssr?

  • On the server-side, we detect the user's device to decide how many items we are showing and then using flex-basis to assign * width to the carousel item.
  • On the client-side, old fashion getting width of the container and assign the average of it to each carousel item.

The UI part of this example is copy paste from for the sake of simplicity. with-material-ui