I have experienced this for various libraries. I think it helps to paste in a package.json in the prompt.
All the models seem to struggle with React three fiber like this. Mixing and matching versions that don't make sense. I can see this being a tough problem given the nature of these models and the training data.
I am going to also try to start giving it a better skeleton to start with and stick to the particular imports when faced with this issue.
My very first prompt with claude 4 was for R3F and it imported a depreciated component as usual.
We can't expect the model to read our minds.