Blame view

components/layout/Layout.js 1.22 KB
jaymehta committed
1
import React, { useEffect } from "react";
jay committed
2 3 4 5 6
import Head from "next/head";
import Header from "./Header";
import Footer from "./Footer";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
jaymehta committed
7
import { loadUser } from "../../redux/actions/userActions";
jaymehta committed
8
import { useDispatch, useSelector } from "react-redux";
jay committed
9

10
const Layout = ({ children, title = "Zango", description = "Zango" }) => {
jaymehta committed
11
  const dispatch = useDispatch();
jaymehta committed
12 13
//   const { loadedUser } = useSelector(state => state.loadedUser);
// console.log(">>>", loadedUser);
jaymehta committed
14 15 16
  useEffect(() => {
    dispatch(loadUser());
  }, []);
jay committed
17 18 19 20 21
  return (
    <div>
      <Head>
        <title>{title}</title>
        <meta charSet="utf-8"></meta>
Ravindra Kanojiya committed
22 23
        {/* <meta name="viewport" content="initial-scale=1.0,width=device-width" /> */}
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
jay committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37
        <meta name="description" content={description} />
        <meta property="og:title" content={title} />
        <meta property="og:description" content={description} />
      </Head>

      <Header></Header>
      <ToastContainer position="bottom-right" />
      {children}
      <Footer></Footer>
    </div>
  );
};

export default Layout;