+
Hook tree case
+
External count: {count}
+
Local state: {localState}
+
+
+
+ );
+}
+
+function useTheme() {
+ const theme = useSyncExternalStore(
+ themeStore.subscribe,
+ themeStore.getSnapshot,
+ );
+
+ return theme;
+}
+
+function MultipleStoresCase() {
+ const count = useSyncExternalStore(
+ counterStore.subscribe,
+ counterStore.getSnapshot,
+ );
+ const theme = useTheme();
+
+ return (
+