title: Next JS Layout component, pass props to children
body: <p>I have found a code that solved my problem in Next JS re rendering when changing pages. But now i need to send props to the children component. I got no idea how i can make it works here, this is my layout.js code. As you can see i can send props to Header component but for children i dont know how, because it is a variable and not a component.</p>
  
  <pre><code>import Header from "../components/header";
  import Footer from "../components/footer";
  import { Fragment } from "react";
  
  export default function Layout({ children, ...pageProps }) {
    return (
      &lt;Fragment&gt;
        &lt;Header
          isRegisterPage={pageProps.isRegisterPage}
          isLoginPage={pageProps.isLoginPage}
          outHome={pageProps.outHome}
        /&gt;
        {children}
        &lt;Footer /&gt;
      &lt;/Fragment&gt;
    );
  }
  </code></pre>
  
  <p>Thank you for the help</p>