Skip to content

Commit 41c5e49

Browse files
committed
fix: setState inside useEffect
1 parent 7e44460 commit 41c5e49

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

examples/sync-demo-expo/src/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ function TestApp({ deviceToken }: { deviceToken: string | null }) {
9797

9898
useEffect(() => {
9999
if (!lastSyncTime || !currentSyncInterval) {
100-
setNextSyncIn(null);
101100
return;
102101
}
103102

@@ -232,7 +231,7 @@ function TestApp({ deviceToken }: { deviceToken: string | null }) {
232231
Last sync: {new Date(lastSyncTime).toLocaleTimeString()}
233232
</Text>
234233
)}
235-
{nextSyncIn != null && (
234+
{nextSyncIn != null && lastSyncTime && currentSyncInterval && (
236235
<Text style={styles.status}>Next sync in {nextSyncIn}s</Text>
237236
)}
238237
</View>

0 commit comments

Comments
 (0)