Skip to content

davidxi/react-array-chunk-render

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

npm

react-array-chunk-render

I had some experience in using React in IE-8 that when rendering a component has children of a long array input, it leads to long script running alert in the browser. So this react component mixin is to avoid the long script running alert by chopping long array children into chunks, and render those children in an asynchornous way.

example

vararrayChunkRenderMixin=require('react-array-chunk-render');varMyComponent=React.createClass({mixins: [arrayChunkRenderMixin],render: function(){this.arrayChunkRender(this.props.data,{// called on each item in the arrayiterator: function(item){returnReact.createElement('li',{children: item});},// called when all children are processedafter: function(result){returnReact.createElement('ul',{children: result});},// called to set the placeholder dom node when in async processloading: function(){returnReact.createElement('span',{children: 'loading ...'});}});returnReact.createElement('div',{children: this._vars.arrayChunkResult});}});

About

A react component mixin to asynchroulsy render long array children

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published