Network request failed in react-native expo problem

  javascript, node.js, react-native, reactjs

I am trying to get data from local server but i am failure to connect local server.I am facing
"Network request failed"

 const testScreen= async ()=> {
        await fetch("http://192.168.56.1:3000/comments")
        .then((response)=>{
            console.log(response.json())
        })

        .catch((error)=>{
            console.log("sorry")
            console.log(error)
        })
}

…error..

Network request failed

at node_moduleswhatwg-fetchdistfetch.umd.js:535:17 in setTimeout$argument_0
at node_modulesreact-nativeLibrariesCoreTimersJSTimers.js:130:14 in _callTimer
at node_modulesreact-nativeLibrariesCoreTimersJSTimers.js:383:16 in callTimers
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:416:4 in __callFunction
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:109:6 in __guard$argument_0
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:364:10 in __guard
at node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:108:4 in callFunctionReturnFlushedQueue
at [native code]:null in callFunctionReturnFlushedQueue

Source: Ask Javascript Questions

LEAVE A COMMENT