✅ Solved: How to pass file to Rive constructor

I’m trying to pre-load a very big rive file to use later.
This is my code roughly:

const riveInstance = new Rive({

canvas: document.createElement("canvas"),

src: riveFileUrl,

onLoad: () => {

setRiveFile(riveInstance.file);

},

});

Then, later, I’m loading it like this:

import { useRive } from "@rive-app/react-canvas";
// ….
const { rive, RiveComponent } = useRive({

file: riveFile,

stateMachines: "bumpy",

autoplay: false,

});

This is throwing an error: “rive.ts:6 Uncaught Error: Rive source file or data buffer required”
The docs are not very clear - how am I supposed to load this file?