MCPcopy Create free account
hub / github.com/dabbott/react-native-express / fetchPosts

Function fetchPosts

examples/files/app/networking.js:16–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14
15 useEffect(() => {
16 async function fetchPosts() {
17 dispatch(actionCreators.loading())
18
19 try {
20 const response = await fetch(
21 'https://jsonplaceholder.typicode.com/posts'
22 )
23 const posts = await response.json()
24 dispatch(actionCreators.success(posts))
25 } catch (e) {
26 dispatch(actionCreators.failure())
27 }
28 }
29
30 fetchPosts()
31 }, [])

Callers 1

AppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected