1.3.0 • Published 2 years ago

xzid v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

这是一个简单生成唯一id的库

安装 Installing

npm i xzid

用法 Usage

React

// List.js
import xzid from 'xzid'

const array = ['one', 'two', 'three']

export const LineItem = ({ item }) => <li key={xzid()}>{item}</li>

export const List = () => array.map(item => <LineItem key={xzid()} item={item} />)
// App.js
import { List } from './List.js'
function App () {
  return (
    <div>
      <h1>这是一个列表</h1>
      <ul>
        <List />
      </ul>
    </div>
  )
}
export default App

贡献者

Aze

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago