I have a code User.container.:
const mapState = (state: AppStateType) => ({
users: getUsers(state),
pageSize: getPageSize(state),
isFetching: getIsFetching(state)
})
const mapDispatch = {
toggleFollowingInProgress,
}
const connector = connect(mapState, mapDispatch)
type PropsFromRedux = ConnectedProps<typeof connector>
export type PropsType = PropsFromRedux & {
onPageChanged?: (page: number) => void
}
in file Users.tsx i make this:
import { PropsType } from './Users.container'
const Users = (props: PropsType) => {
...
}
The variable isFetching is not required for Users.tsx. But the compiler throws an error because i can not through ? make mapState isFetching optional.
What to do? I need to get rid of code duplication