Pass a prop to every child component

Is it possible to pass a prop containing a function to any child ? More precisely I would like to pass a function from a component to every {children} component :

<>
    <Navbar />
    <main>{children}</main>
    <Footer />
</>

Answer

You should then use something like Context for that.

The props you pass to your Context Provider will be available to all it’s children. But you won’t get them via props, you need to get them via the Context Consumer.

But the good thing is Context Consuming hooks are available to make it easy to do so.