Pass props from layout to children in Gatsby Pass props from layout to children in Gatsby reactjs reactjs

Pass props from layout to children in Gatsby


But there are props, you're just not passing them to children.

In your layout file, instead of:

export default ({ children }) // ... etc

do

export default (props) {  const myOwnProperties = { foo: true };  return (    {props.children({ ...props, ...myOwnProperties })}  );}

You see, the props are passed automatically until you add your own.