npm.io
1.0.3 • Published 6 years ago

@feizheng/react-list

Licence
MIT
Version
1.0.3
Deps
4
Size
21 kB
Vulns
0
Weekly
0

react-list

A list component.

version license size download

installation

npm install -S @feizheng/react-list

update

npm update @feizheng/react-list

properties

Name Type Required Default Description
className string false - The extended className for component.
virtual bool false - If node name is React.Framgment.
nodeName any false 'div' Use customize node name(tagName or ReactElement).
items array false [] List data source.
template func false noop List item template.

usage

  1. import css
@import "~@feizheng/react-list/dist/style.scss";

// customize your styles:
$react-list-options: ()
  1. import js
import React from 'react';
import ReactDOM from 'react-dom';
import ReactList from '@feizheng/react-list';
import './assets/style.scss';

class App extends React.Component {
  state = {
    items: require('./assets/data.json')
  };

  template = ({ item }) => {
    return (
      <div key={item.domId} className="is-item">
        {item.name}
      </div>
    );
  };

  render() {
    return (
      <div className="app-container">
        <ReactList items={this.state.items} template={this.template} />
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.

Keywords