fetch-suspense:与React 16.6的Suspense组件兼容的React钩子

时间:2021-02-03 15:26:16
【文件属性】:
文件名称:fetch-suspense:与React 16.6的Suspense组件兼容的React钩子
文件大小:43KB
文件格式:ZIP
更新时间:2021-02-03 15:26:16
react javascript fetch npm typescript useFetch useFetch是一个React钩子,它支持React 16.6 Suspense组件的实现。 的中型文章中概述了此程序包的设计决策和开发过程。 安装 npm install fetch-suspense或 yarn add fetch-suspense 例子 基本范例 import useFetch from 'fetch-suspense' ; import React , { Suspense } from 'react' ; // This fetching component will be delayed by Suspense until the fetch request // resolves. The return value of useFetch will be the response of the server. const MyFetchingComponent = ( ) => { const response = useFetch ( '/path/to/api' , { method : 'POST' } ) ; r
【文件预览】:
fetch-suspense-master
----.gitignore(54B)
----package.json(1KB)
----src()
--------fetch-suspense.ts(5KB)
----.travis.yml(928B)
----LICENSE(1KB)
----tsconfig.json(602B)
----README.md(5KB)
----tests()
--------use-fetch.test.ts(498B)
--------yse-fetch-without-window-fetch.test.ts(1KB)
--------utils()
--------create-use-fetch.test.ts(5KB)
--------use-fetch-without-window.test.ts(1KB)
----.mocharc.js(401B)
----.npmignore(102B)
----yarn.lock(78KB)

网友评论