1
api 호출을 로컬에서 캐시 할 수 있는지 알아낼 수 없었기 때문에 앱을 닫고 다시 시작하면 여전히 호출됩니다. 나는 그것을react native/redux로 API 요청을 캐시 할 수 있습니까?
loadData(userId) {
// Injected into props by React Redux `connect()` call:
let { dispatch, posts } = this.props
if (posts[userId]) {
// There is cached data! Don't do anything.
return
}
// Reducer can react to this action by setting
// `isFetching` and thus letting us show a spinner.
dispatch(loadPostsRequest(userId))
// Reducer can react to these actions by filling the `users`.
fetch(`http://myapi.com/users/${userId}/posts`).then(
response => dispatch(loadPostsSuccess(userId, response)),
error => dispatch(loadPostsFailure(userId, error))
)
}
사용해야합니다
는 돌아 오는의 this 페이지에서 나는이 같은 미들웨어와 캐시하는 것이 가능하다는 것을 보았다? 그리고 앱을 닫은 후에도 캐시가 남아 있습니까?
고마워요! 나는 그것을 지금 시도 할 것이다. –