rsnext/examples/with-react-multi-carousel
Tim Neutkens a90a55545b
Deprecate Container usage (#8327)
* Remove Container from examples

* Update readme to reflect Container removal
2019-08-11 22:02:33 +02:00
..
components Run lint-fix 2019-05-28 16:06:13 -07:00
pages Deprecate Container usage (#8327) 2019-08-11 22:02:33 +02:00
src Remove usage of process.browser (#7651) 2019-06-24 16:34:10 -04:00
next.config.js Added example with react-multi-carousel for rendering items on the server-side (#6820) 2019-04-03 12:58:59 +02:00
package.json Update remaining examples to latest Next.js 2019-07-08 19:37:58 -04:00
README.md Move syntax formatting to prettier (#7454) 2019-05-29 13:57:26 +02:00
style.css Added example with react-multi-carousel for rendering items on the server-side (#6820) 2019-04-03 12:58:59 +02:00

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