All Projects → tj → React Batch

tj / React Batch

Batch component for performant frequent updates (flush on count or interval)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Batch

light-ui
A lightly React UI library
Stars: ✭ 38 (-85.27%)
Mutual labels:  react-component
react-hotkey-tooltip
A global Hotkey provider with built in tooltip for React
Stars: ✭ 34 (-86.82%)
Mutual labels:  react-component
react-crossword
A flexible, responsive, and easy-to-use crossword component for React apps.
Stars: ✭ 80 (-68.99%)
Mutual labels:  react-component
react-super-treeview
👏 Finally, a React Treeview component which is customizable on every level
Stars: ✭ 98 (-62.02%)
Mutual labels:  react-component
ReStory
A static site generator with MDX for React documentation.
Stars: ✭ 24 (-90.7%)
Mutual labels:  react-component
dsccodecollab.github.io
Official website of the coding culture
Stars: ✭ 12 (-95.35%)
Mutual labels:  react-component
react-native-value-picker
Cross-Platform iOS(ish) style picker for react native.
Stars: ✭ 18 (-93.02%)
Mutual labels:  react-component
react-ago-component
A component for React that renders the approximate time ago in words from a specific past date using an HTML5 time element.
Stars: ✭ 25 (-90.31%)
Mutual labels:  react-component
react-tabllist
React-based customizable style table or list components that support event and callback functions.
Stars: ✭ 20 (-92.25%)
Mutual labels:  react-component
react-recycled-scrolling
Simulate normal scrolling by using only fixed number of DOM elements for large lists of items with React Hooks
Stars: ✭ 26 (-89.92%)
Mutual labels:  react-component
react-star-ratings
A customizable svg star rating component for selecting x stars or visualizing x stars
Stars: ✭ 128 (-50.39%)
Mutual labels:  react-component
rc-charts
一个基于BizCharts的图表库
Stars: ✭ 22 (-91.47%)
Mutual labels:  react-component
react-contentful
📰 A React component library that makes it super simple to compose Contentful content into your sites and applications.
Stars: ✭ 58 (-77.52%)
Mutual labels:  react-component
auto-ui
凹凸 UI 组件
Stars: ✭ 13 (-94.96%)
Mutual labels:  react-component
date-range-picker
⚛️📆 Flexible React date range picker calendar with no dependencies.
Stars: ✭ 94 (-63.57%)
Mutual labels:  react-component
react-infinity-menu
A react component that displays an unlimited deep menu
Stars: ✭ 59 (-77.13%)
Mutual labels:  react-component
react-translator-component
React language translation module for developing a multilingual project.
Stars: ✭ 13 (-94.96%)
Mutual labels:  react-component
React Telephone Input
React component for entering and validating international telephone numbers
Stars: ✭ 254 (-1.55%)
Mutual labels:  react-component
react-pits
React 中的坑
Stars: ✭ 29 (-88.76%)
Mutual labels:  react-component
react-pinch-and-zoom
A react container component with pinch-to-zoom gesture interaction.
Stars: ✭ 33 (-87.21%)
Mutual labels:  react-component

React Batch

Batches and flushes renders based on the number of items available. Useful for large lists of frequently updated items which would otherwise cause performance problems with React's sync rendering.

Installation

$ yarn add tj/react-batch

Properties

  • count: the number of items available for rendering (required)
  • flushCount: render after a given number of items (required)
  • flushInterval: render after a given interval is exceeded (required)
  • render: render callback (required)
  • debug: enable debug logging

Example

class BatchExample extends Component {
  constructor() {
    super()
    this.list = this.list.bind(this)
    this.state = { items: [] }
    this.renders = 0
  }

  async componentDidMount() {
    while (1) {
      const prev = this.state.items
      const items = [`Hello World #${prev.length}`, ...prev]
      this.setState({ items })
      await sleep(Math.random() * 30)
    }
  }

  list() {
    const { items } = this.state

    return <div>
      <p>Count: {items.length}</p>
      <p>Renders: {this.renders++}</p>
      <ul>
        {items.map((v, i) => <li key={i}>{v}</li>)}
      </ul>
    </div>
  }

  render() {
    return <Batch
      flushCount={10}
      flushInterval={150}
      count={this.state.items.length}
      render={this.list}
      debug />
  }
}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].