score:0

Accepted answer
    useEffect(() => {
        if(!userInfo){
            props.history.push('/login');
        }else{
            dispatch(getUserProfile(userId));
        }
    }, [dispatch,userId])

    if (userData) {
      const {posts, data} = userData;**
      return (
        <section>
            <div className={Styles.Container}>
                <h1>{data.userName}</h1>
                <h1>{data.followers.length} followers</h1>
                <h1>{data.following.length} following</h1>
                <h1>{posts.length} posts</h1>
            </div>
        </section>
      )
    }

    return <div>Loading...</div>

Related Query

More Query from same tag