Replies: 1 comment
-
I have no idea what an You can coerce it to
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In this link, we see how to setup React Native, React Query and NetInfo: https://react-query.tanstack.com/react-native#online-status-management
But, as TS typing and the https://github.com/react-native-netinfo/react-native-netinfo#types says,
state.isConnected
isboolean | null
.If we try to
setOnline(state.isConnected)
, it throwsArgument of type 'boolean | null' is not assignable to parameter of type 'boolean | undefined'. Type 'null' is not assignable to type 'boolean | undefined'
.The link above about
isConnected
:If there is an active network connection. Defaults to null on most platforms for unknown networks. Note: Web browsers report network type unknown for many otherwise valid networks (https://caniuse.com/netinfo), so isConnected may be true or false and represent a real connection status even for unknown network types in certain cases.
What to do when the value is
null
?Beta Was this translation helpful? Give feedback.
All reactions