You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently in the process of migrating to @sanity/astro and I was wondering how I can access the sanity client in my React components (with active client directives) / on the client side?
@sanity/astro introduces the useSanityClient() function, which makes the sanity client accessible to .astro templating files, but in my case I am passing the fetched Sanity CMS data from a .astro file down to a React .tsx component, which worked before (using the @sanity/client package), but now seems to fail: [@sanity/astro]: sanityClientInstance has not been initialized correctly.
Help on this matter is very much appreciated!
Thank you in advance 😊
The text was updated successfully, but these errors were encountered:
what's the status of this? is it safe to update the plugin to current version? i'm still sitting on v1.3.0 as i have a React component that uses the sanity client.
@jedifunk To my knowledge it should be safe for you to update to the current version, at least everything works like a charm for me. Been using the sanity client in multiple React components without any issues. Proper types are shipped as of recent updates as well, in case you are using TypeScript 😊
I am currently in the process of migrating to @sanity/astro and I was wondering how I can access the sanity client in my React components (with active client directives) / on the client side?
@sanity/astro introduces the useSanityClient() function, which makes the sanity client accessible to .astro templating files, but in my case I am passing the fetched Sanity CMS data from a .astro file down to a React .tsx component, which worked before (using the @sanity/client package), but now seems to fail: [@sanity/astro]: sanityClientInstance has not been initialized correctly.
Help on this matter is very much appreciated!
Thank you in advance 😊
The text was updated successfully, but these errors were encountered: