Sha256: 03976910c595594f45207cfc8423616a5d7561a3344f72e643ac7a0cc8d8989d
Contents?: true
Size: 688 Bytes
Versions: 1
Compression:
Stored size: 688 Bytes
Contents
import React, { useEffect, useState } from "react"; import PropTypes from "prop-types"; import store from "stores/admin"; import User from "components/admin/User"; import UserModel from "models/User"; function UserListWrapper(props) { const [users, setUsers] = useState(props.users); useEffect(() => { const unsubscribe = store.subscribe(() => setUsers(store.getState().users)); return () => { unsubscribe(); }; }); const list = users.map(user => <User key={`user_${user.id}`} user={user} />); return <>{list}</>; } UserListWrapper.propTypes = { users: PropTypes.arrayOf(PropTypes.instanceOf(UserModel)).isRequired }; export default UserListWrapper;
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
loco-rails-3.0.4 | test/dummy/frontend/js/containers/admin/StatefulUserList.js |