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

https://github.com/afeiship/react-list

List component for react.
https://github.com/afeiship/react-list

each for-each list map react

Last synced: 6 months ago
JSON representation

List component for react.

Awesome Lists containing this project

README

          

# react-list
> List component for react.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install -S @jswork/react-list
```

## usage
1. import css
```scss
@import "~@jswork/react-list/dist/style.css";

// or use sass
@import "~@jswork/react-list/dist/style.scss";
```
2. import js
```js
import ReactList from '@jswork/react-list';
import './index.css';
import '@jswork/react-list/dist/style.scss';
import { useEffect, useState } from 'react';

function App() {
const [users, setUsers] = useState([]);
const [isLoading, setIsLoading] = useState(true);

useEffect(() => {
setIsLoading(true);
setTimeout(() => {
setUsers([
{ name: 'John', age: 25 },
{ name: 'Mary', age: 30 },
{ name: 'Tom', age: 35 },
{ name: 'Jerry', age: 40 }
]);
setIsLoading(false);
}, 2000);
}, []);

return (


Build Time: {BUILD_TIME}

react-list



setUsers([])}>
Set Empty

setUsers([...users, { name: 'New', age: 10 }])}
>
Add New

setUsers(users.slice(0, -1))}>
Remove Last



{
return
Loading...
;
}}
templateEmpty={() => {
return
Empty View
;
}}
template={({ item, index }) => {
return (


{index + 1}, {item.name} - {item.age}



);
}}
/>


);
}

export default App;
```

## preview
- https://afeiship.github.io/react-list/

## license
Code released under [the MIT license](https://github.com/afeiship/react-list/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-list
[version-url]: https://npmjs.org/package/@jswork/react-list

[license-image]: https://img.shields.io/npm/l/@jswork/react-list
[license-url]: https://github.com/afeiship/react-list/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-list
[size-url]: https://github.com/afeiship/react-list/blob/master/dist/react-list.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-list
[download-url]: https://www.npmjs.com/package/@jswork/react-list