Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hellohejinyu/react-blocks-scroll-sync

Synchronously scrolling multiple blocks.
https://github.com/hellohejinyu/react-blocks-scroll-sync

react scroll scrollsync sync

Last synced: 3 days ago
JSON representation

Synchronously scrolling multiple blocks.

Awesome Lists containing this project

README

        

# react-blocks-scroll-sync · [![npm](https://img.shields.io/npm/v/react-blocks-scroll-sync.svg)](https://www.npmjs.com/package/react-blocks-scroll-sync)

Synchronously scrolling multiple blocks.

## Install

``` shell
npm i --save react-blocks-scroll-sync
```

## Quick Overview
``` jsx
import React, { useCallback } from 'react'
import Container from 'react-blocks-scroll-sync'

const Block = Container.Block

const randomColor = () => {
const r = Math.floor(Math.random() * 256)
const g = Math.floor(Math.random() * 256)
const b = Math.floor(Math.random() * 256)
const color = `rgb(${r},${g},${b})`
return color
}

const App = () => {
const renderMultiBox = useCallback(() => {
return new Array(100).fill(1).map((v, k) => {
return (


{k}

)
})
}, [])

return (



{renderMultiBox()}
{renderMultiBox()}
{renderMultiBox()}


)
}

export default App
```



## Tips

⚠️ The number of child elements of each `` component need to be same.