Skip to content

Could not find react-scroll-parallax context value. Please ensure the component is wrapped in a <ParallaxProvider> #233

Closed
@artem-burasov

Description

@artem-burasov

Good afternoon.
I can't use this library after moving the project from CRA to Next.js. I get an error that the provider cannot be imported, although it is added to _app.jsx.

Has anyone encountered a similar problem?

_app.jsx

const App = ({ Component, pageProps }) => {
    return (
        <ParallaxProvider>
            <WagmiConfig config={wagmiConfig}>
                <ScrollToTop />

                <ApolloProvider client={defaultClient}>
                    <Provider store={store}>
                            <Component {...pageProps} />
                    </Provider>
                </ApolloProvider>
            </WagmiConfig>
        </ParallaxProvider>
    )
}

parallax component

import { useParallax } from "react-scroll-parallax";

const Bubble = ({ isLeft, className, children }) => {
    const { ref } = useParallax({
        rotate: isLeft ? [0, 20] : [0, -20],
        translateY: [40, -40]
    });

    return (
        <div className={className} ref={ref}>
            { children }
        </div>
    );
};

export default Bubble;

List of related npm package versions

"next": "^14.0.2",
"react-scroll-parallax": "^3.4.3",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions