import React, { useEffect } from "react"; import { Link } from "react-router-dom"; import { useDispatch, useSelector } from "react-redux"; import DashboardActions from "./DashboardActions"; import Experience from "./Experience"; import Education from "./Education"; import { getCurrentProfile, deleteAccount } from "../../actions/profile"; const Dashboard = () => { const dispatch = useDispatch(); useEffect(() => { function fetchData() { dispatch(getCurrentProfile()); } fetchData(); }, [dispatch]); const user = useSelector((state) => state.auth.user); const profile = useSelector((state) => state.profile.profile); return (

Dashboard

Welcome {user && user.name}

{profile !== null ? ( <>
) : ( <>

You have not yet setup a profile, please add some info

Create Profile )}
); }; export default Dashboard;