【文件属性】:
文件名称:with-fetch:React HOC来获取数据
文件大小:24KB
文件格式:ZIP
更新时间:2021-05-17 18:57:43
JavaScript
提取
专为设计的用于简单数据获取的HOC。 如果您将不传递给它的请求函数传递给它,则原始响应将返回到data道具中的最终组件。
安装
$ yarn add with-fetch $ npm install with-fetch
这个怎么运作
该组件导出两个HOC
withFetch
displayWhileLoading
withFetch
此HOC是获取的地方。 HOC将获取,解析然后将数据传递到最终组件。
基本用法
import { withFetch } from 'with-fetch'
import { compose } from 'recompose'
import fetch from 'isomorphic-fetch'
export const MyComopnent = compose (
withFetch ( props => fetch ( `ht
【文件预览】:
with-fetch-master
----.gitignore(322B)
----.babelrc(84B)
----package.json(813B)
----src()
--------spinner.css(270B)
--------index.js(190B)
--------with-fetch.js(2KB)
--------index.d.ts(589B)
----dist()
--------spinner.css(270B)
--------index.js(333B)
--------with-fetch.js(3KB)
--------index.d.ts(589B)
----LICENSE(1KB)
----README.md(2KB)
----yarn.lock(61KB)