Skip to content

Instantly share code, notes, and snippets.

@koss-lebedev
Last active June 24, 2019 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koss-lebedev/49765ed5beed8324783748d82828b52b to your computer and use it in GitHub Desktop.
Save koss-lebedev/49765ed5beed8324783748d82828b52b to your computer and use it in GitHub Desktop.
import React, { useEffect, FC } from 'react'
import { connect } from 'react-redux'
import UserList from '../../components/UserList'
import { RootState, RootDispatch } from '../../store'
type UsersProps = ReturnType<typeof mapState> & ReturnType<typeof mapDispatch>
const Users: FC<UsersProps> = ({ users, load }) => {
useEffect(() => {
load()
}, [])
return <UserList users={users} />
}
const mapState = (state: RootState) => ({
users: state.users,
})
const mapDispatch = (dispatch: RootDispatch) => ({
load: dispatch.users.load,
})
export default connect(mapProps, mapDispatch)(Users)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment