✅ Solved: calling rive canvas from another part of the project using react

Hello, I’m trying to create a website and I want to call the rive file I have set up into the hero section of my site, but I can’t figure out how to do that and nothing is working.

Here is the code that calls the .riv file:


import { useRive, Layout, Fit, Alignment } from "@rive-app/react-canvas";

//Loads the rive file
export const RiveDemo = () => {
    const { RiveComponent } = useRive({
        src: "worm.riv",
        stateMachines: "State Machine 1",
        layout: new Layout({
            fit: Fit.FitWidth,
            alignment: Alignment.Center,
        }),
        autoplay: true,
    });

    return <RiveComponent />;
};

export default function worm_bg() {
    return (
        <div className="RiveContainer">
            <RiveDemo />
        </div>
    );
} 

and here is where I am trying to call it in my hero section:

return (
        <section className={"min-h-screen w-full flex justify-center items-center"}>
            <div
                className="w-[1852px] h-[952px] relative bg-squirmyellow rounded-[76px] outline outline-[24px] outline-offset-[-24px] outline-squirmgreen overflow-hidden">
                <div className="w-[1653px] h-[919px] left-[99px] top-[16px] absolute">

                    {/*rive canvas*/}

                    <div className="w-[1653px] h-[919px] left-[99px] top-[16px] absolute">
                        <RiveDemo />
                    </div>