TylerBarnes / gatsby-plugin-transition-link

A link component for page transitions in gatsby
537 stars 70 forks source link

Accessing the location prop when using as alternative to gatsby layout plugin #82

Open EricSSartorius opened 5 years ago

EricSSartorius commented 5 years ago

I have a Gatsby site that uses gatsby-plugin-layout that I would like to add transitions to. I followed the instructions in the docs to get rid of the plugin and in its place use:

// gatsby-config.js
module.exports = {
    plugins: [
       {
          resolve: "gatsby-plugin-transition-link",
          options: {
              layout: require.resolve(`./src/components/Layout.jsx`)
            }
       }
    ]
];

However, after doing this I no longer have access to the location prop that was being passed through before. in V2 to get location from a page it needs to be passed as a prop from a page but doing that would cause nested layouts. Is there a step I am missing to get access to location like gatsby-layout-plugin has?

Badyl1g commented 5 years ago

I have a similar issue but instead of using gatsby-plugin-layout I implemented a custom wrapPageElement. Now I can't access transitionProps from <TransitionState /> component (which is used in my <Layout />)