aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/AnotherComponent.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/AnotherComponent.tsx')
-rw-r--r--src/components/AnotherComponent.tsx28
1 files changed, 28 insertions, 0 deletions
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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage