Passing children page props using layout

This is my first time learning typescript and not sure if I'm using it right. I tried to pass in the children props to my dashboard page, but it doesn't appear and it's redirect to the new page instead

From Layout.tsx


type LayoutProps = {
  children: any;
  address: any;
};

const Layout = ({ children, address }: LayoutProps): JSX.Element => {
  
  return (
    <>
      <Wrapper>
        <Sidebar />
        <MainContainer>
          <Header walletAddress={address} />
          {children}
        </MainContainer>
      </Wrapper>
    </>
  );
};

export default Layout;


From Dashboard.tsx

type DashboardProps = {
  address: string;
};

const Dashboard = ({ address }: DashboardProps): JSX.Element => {
  return (
    <Layout address={address}>
      <div></div>
    </Layout>
  );
};

export default Dashboard;



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)