From e970aa7a26fecfa38041bb1cfa59a1d5f40a0194 Mon Sep 17 00:00:00 2001
From: Pinapelz <yukais@pinapelz.com>
Date: Fri, 23 Aug 2024 15:06:37 -0700
Subject: initial groundwork for interactivity via mdx

---
 src/components/AnotherComponent.tsx | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 src/components/AnotherComponent.tsx

(limited to 'src/components/AnotherComponent.tsx')

diff --git a/src/components/AnotherComponent.tsx b/src/components/AnotherComponent.tsx
new file mode 100644
index 0000000..f74e924
--- /dev/null
+++ b/src/components/AnotherComponent.tsx
@@ -0,0 +1,28 @@
+import React, { useState, useEffect } from 'react';
+
+const AnotherComponent: React.FC = () => {
+  const [selectedWorld, setSelectedWorld] = useState<string | null>(null);
+
+  useEffect(() => {
+    // Load selected world from localStorage
+    const savedWorld = localStorage.getItem('selectedWorld');
+    if (savedWorld) {
+      setSelectedWorld(savedWorld);
+    }
+  }, []);
+
+  return (
+    <div>
+      <p>Selected World: {selectedWorld}</p>
+      <button onClick={() => {
+        const newWorld = 'New World';
+        setSelectedWorld(newWorld);
+        localStorage.setItem('selectedWorld', newWorld); // Save to localStorage
+      }}>
+        Change World
+      </button>
+    </div>
+  );
+};
+
+export default AnotherComponent;
\ No newline at end of file
-- 
cgit v1.2.3

