import React from "react";
import { connect } from "react-redux";
import {
getUsersThunkCrstrong texteator, onPageChangedCreator, unfollowCreator, followCreator
} from "../../redux/users-reducer";
import togglefollowingProgress from "../../redux/users-reducer";
import Users from './Users';
import Preloader from "../common/Preloader/Preloader";
import { withAuthRedirect } from '../../hoc/withAuthRedirect';
import { compose } from "redux";
import { getUsers, getPageSize, getTotalUsersCount, getCurrentPage, getIsFetching, getFollowingInProgress } from "../../redux/users-selectors";
import { userType } from '../../types/types'
import { AppStateType } from '../../redux/redux-store'
type MapStatePropsType = {
currentPage: number,
pageSize: number,
isFetching: boolean,
totalUsersCount: number,
users: Array<userType>,
isAuth?: boolean,
followingInProgress: Array<number>,
}
type MapDispatchPropsType = {
togglefollowingProgress: () => void,
unfollowCreator: (userId: number) => void,
followCreator: (userId: number) => void,
}
type DidMountPropsType = {
getRequestUsers: (currentPage: number, pageSize: number) => void,
onPageChanged: (currentPage: number, pageSize: number) => void,
}
class UsersContainer extends React.Component<MapStatePropsType & MapDispatchPropsType & DidMountPropsType> {
componentDidMount() {
this.props.getRequestUsers(this.props.currentPage, this.props.pageSize);
this.props.onPageChanged(this.props.currentPage, this.props.pageSize);
}
render() {
return (
<div>
{this.props.isFetching ? <Preloader /> : null}
<Users
pageSize={this.props.pageSize}
onPageChanged={this.props.onPageChanged}
totalUsersCount={this.props.totalUsersCount}
currentPage={this.props.currentPage}
users={this.props.users}
togglefollowingProgress={this.props.togglefollowingProgress}
followingInProgress={this.props.followingInProgress}
unfollow={this.props.unfollowCreator}
follow={this.props.followCreator}
isAuth={this.props.isAuth}
/>
</div>
)
}
}
let mapStateToProps = (state: AppStateType): MapStatePropsType => {
return {
users: getUsers(state),
pageSize: getPageSize(state),
totalUsersCount: getTotalUsersCount(state),
currentPage: getCurrentPage(state),
isFetching: getIsFetching(state),
followingInProgress: getFollowingInProgress(state),
}
}
export default compose(
connect(mapStateToProps, {
togglefollowingProgress, getRequestUsers: getUsersThunkCreator,
onPageChanged: onPageChangedCreator, unfollowCreator, followCreator,
}),
withAuthRedirect
)(UsersContainer)
The error crashes, I can't solve it, please help.As I understand it, the error reports that there are no such properties, but they are in mapStateToProps, in the dispatches object, in the connect function { togglefollowingProgress, getRequestUsers: getUsersThunkCreator, onPageChanged: onPageChangedCreator, unfollowCreator, followCreator, }. Error: Enter "{ page size: quantity; onPageChanged: (current page: quantity, page size: number) => unacceptable; Total number of users: number; current page: number; users: its user type[]; togglefollowingProgress: () => unacceptable; followingInProgress: [number]; unsubscribe: (user ID: number) => unacceptable; follow: (user id: number) => unacceptable; isAuth: boolean value | undefined; }"cannot be assigned to the type "IntrinsicAttributes & omit<ClassAttributes & PropsType, "isAuth"> & ConnectProps". Property "Page Size" Property "Internal attributes and Omit <Class attributes and type of details, "is Auth"> & ConnectProps".