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.
- Host: GitHub
- URL: https://github.com/afeiship/react-list
- Owner: afeiship
- Created: 2019-12-12T07:27:43.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-22T09:56:07.000Z (11 months ago)
- Last Synced: 2025-06-29T01:03:59.325Z (6 months ago)
- Topics: each, for-each, list, map, react
- Language: TypeScript
- Homepage:
- Size: 611 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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