diff --git a/README.md b/README.md index cc4af5c..6168dc5 100644 --- a/README.md +++ b/README.md @@ -250,8 +250,13 @@ const config = { const clock = new clockSync(config); -// this handler will receive the device's network status -function handleConnectivityChange = isConnected => { +// set initial state +NetInfo.isConnected.fetch().then(isConnected => { + clock.setOnline(isConnected); +}); + +// this handler will receive the device's network status changes +function handleConnectivityChange (isConnected) { clock.setOnline(isConnected); }