"@solana/wallet-adapter-base": "^0.9.5",
"@solana/wallet-adapter-react": "0.15.9",
"@solana/wallet-adapter-react-ui": "0.9.12",
"@solana/wallet-adapter-wallets": "0.17.2", 

These are the dependencies installed in my dapp but this error occurs : 'WalletProvider as an ancestor of the component that uses WalletContext'

Error screen short

  • What version of React are you using? Did you start with a known working example?
    – Bryon M
    Aug 12, 2022 at 12:14
  • I am using react 17.0.2 . This error occurred while I was switching the old one to the latest. In the old one there was this issue : solana.stackexchange.com/questions/1271/… Aug 12, 2022 at 13:36
  • Use the starter example in that post and react 18. Get the example working and add on from there.
    – Bryon M
    Aug 12, 2022 at 19:55

1 Answer 1


The topmost error ‘You have tried to read wallets on a WalletContext without providing one’ is the error to heed.

Make sure to include a <WalletProvider> at least one component above the one in which you try to read from it.

See setup for an example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.