diff --git a/apps/example-ssr/src/components/InternalLink.astro b/apps/example-ssr/src/components/InternalLink.astro
index 96517d66..235c2d42 100644
--- a/apps/example-ssr/src/components/InternalLink.astro
+++ b/apps/example-ssr/src/components/InternalLink.astro
@@ -1,16 +1,15 @@
---
-import { useSanityClient } from "@sanity/astro";
+import { sanityClient } from "sanity:client";
const { node } = Astro.props;
const { markDef } = node;
-const client = useSanityClient();
// Only deal with posts links for this example
-const destination = markDef._ref && await client.fetch(
+const destination = markDef._ref && await sanityClient.fetch(
`* [_type == "post" && _id == $id] {slug {current}}[0]`,
{ id: markDef._ref }
);
-const linkText = node.children.map(c => c.text).join(' ')
+const linkText = node.children.map((c: any) => c.text).join(' ')
---
{
diff --git a/apps/example-ssr/src/components/NewsBar.jsx b/apps/example-ssr/src/components/NewsBar.jsx
new file mode 100644
index 00000000..edd45649
--- /dev/null
+++ b/apps/example-ssr/src/components/NewsBar.jsx
@@ -0,0 +1,29 @@
+/**
+ * A dynamic Newsbar that fetches content live from Sanity.
+ *
+ */
+import { useState, useEffect, useCallback } from "react";
+import { sanityClient } from "sanity:client";
+
+export function NewsBar() {
+ const [news, setNews] = useState({ message: "Loading news…" });
+ const client = sanityClient;
+ const getNews = useCallback(async () => {
+ const response = await client.fetch(
+ `*[_type == "sanityIoSettings"][0].banner`
+ );
+ setNews(response || { message: "no news" });
+ }, [client]);
+
+ useEffect(() => {
+ getNews();
+ }, [getNews]);
+
+ return (
+
+ );
+}
diff --git a/apps/example-ssr/src/components/SanityImage.astro b/apps/example-ssr/src/components/SanityImage.astro
index e3cf8df9..fd6a5484 100644
--- a/apps/example-ssr/src/components/SanityImage.astro
+++ b/apps/example-ssr/src/components/SanityImage.astro
@@ -1,9 +1,8 @@
---
import imageUrlBuilder from "@sanity/image-url";
-import {useSanityClient} from "@sanity/astro"
+import {sanityClient} from "sanity:client"
-const client = useSanityClient()
-const builder = imageUrlBuilder(client)
+const builder = imageUrlBuilder(sanityClient)
const {node} = Astro.props
const { width = 960 } = Astro.props
@@ -11,11 +10,11 @@ const { width = 960 } = Astro.props
// See https://www.sanity.io/docs/presenting-images for general documentation on
// presenting images, and https://www.sanity.io/docs/image-url for specifics on
// this builder API
-const image = builder
+const image = node && builder
.image(node)
.width(width)
.fit('max')
.auto('format')
---
-
\ No newline at end of file
+{image &&
}
\ No newline at end of file
diff --git a/apps/example-ssr/src/layouts/Layout.astro b/apps/example-ssr/src/layouts/Layout.astro
index 2142385b..c9e95ba0 100644
--- a/apps/example-ssr/src/layouts/Layout.astro
+++ b/apps/example-ssr/src/layouts/Layout.astro
@@ -1,4 +1,6 @@
----
+---
+import { NewsBar } from '../components/NewsBar';
+
interface Props {
title: string;
}
@@ -17,6 +19,7 @@ const { title } = Astro.props;